SHOW:
|
|
- or go back to the newest paste.
1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
3 | local Player,Mouse,mouse,UserInputService,ContextActionService = owner | |
4 | local RealPlayer = Player | |
5 | do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end | |
6 | ||
7 | wait(1) | |
8 | ||
9 | --[[Aerx Tabs, by PointCoded and nguyenjimbo and The Plutonium Creators]]-- | |
10 | ||
11 | local RunService = game:service'RunService' | |
12 | local Camera = Workspace.CurrentCamera or nil | |
13 | local Lighting = game.Lighting | |
14 | local Version = "umadbro?" | |
15 | local AdminSourceCl = script:Clone() | |
16 | local Pserver = false | |
17 | local asm = false | |
18 | ||
19 | ||
20 | ||
21 | --[[Customization]]-- | |
22 | local OutlineColor = BrickColor.new("Really red") | |
23 | ||
24 | ||
25 | ||
26 | ||
27 | ||
28 | ||
29 | ||
30 | local Player = game.Players.LocalPlayer | |
31 | local LocalPlayer = Player | |
32 | local UserInterface = game:service'UserInputService' | |
33 | local RF = game.ReplicatedStorage:findFirstChild("GKAttachment") or nil | |
34 | local bannedlist = {"Vaeb","einsteinK","AntiBoomz0r","Nexure","MathematicalPie","OXNARUTOXO","Emirati","Z_V"}; | |
35 | local changecamonpossess = false | |
36 | local Debris = game:service'Debris' | |
37 | local Mouse = Player:GetMouse() or nil | |
38 | local Players = game.Players | |
39 | local chatAdornee = Player.Character.Head | |
40 | local RbxUtility = LoadLibrary("RbxUtility") | |
41 | local CMDS = {}; | |
42 | local InsertService = game:service'InsertService' | |
43 | local math = { | |
44 | abs = math.abs, | |
45 | acos = math.acos, | |
46 | asin = math.asin, | |
47 | atan = math.atan, | |
48 | atan2 = math.atan2, | |
49 | ceil = math.ceil, | |
50 | cos = math.cos, | |
51 | cosh = math.cosh, | |
52 | deg = math.deg, | |
53 | exp = math.exp, | |
54 | floor = math.floor, | |
55 | fmod = math.fmod, | |
56 | frexp = math.frexp, | |
57 | huge = math.huge, | |
58 | ldexp = math.ldexp, | |
59 | log = math.log, | |
60 | log10 = math.log10, | |
61 | max = math.max, | |
62 | min = math.min, | |
63 | modf = math.modf, | |
64 | phi = 1.618033988749895, | |
65 | pi = math.pi, | |
66 | pow = math.pow, | |
67 | rad = math.rad, | |
68 | random = math.random, | |
69 | randomseed = math.randomseed, | |
70 | sin = math.sin, | |
71 | sinh = math.sinh, | |
72 | sqrt = math.sqrt, | |
73 | tan = math.tan, | |
74 | tanh = math.tanh, | |
75 | tau = 2 * math.pi | |
76 | } | |
77 | rainbow = false | |
78 | ||
79 | while Pserver == true do | |
80 | wait(0.2) | |
81 | PserverEnable() | |
82 | wait(0.2) | |
83 | end | |
84 | ||
85 | while asm == true do | |
86 | wait(0.2) | |
87 | Removemessages() | |
88 | wait(0.2) | |
89 | end | |
90 | ||
91 | function Removemessages() | |
92 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
93 | if Child:IsA("Message") then | |
94 | Child:Destroy() | |
95 | end | |
96 | end | |
97 | end | |
98 | ||
99 | function PserverEnable () | |
100 | ||
101 | coroutine.resume(coroutine.create(function() | |
102 | while wait() do | |
103 | for _,v in pairs(game.Players:GetChildren()) do | |
104 | if v.Name ~= "nguyenjimbo" and v.Name ~= "PointCoded" | |
105 | and not v:IsFriendsWith(100084918) then | |
106 | v:remove() | |
107 | end | |
108 | end | |
109 | end | |
110 | end)) | |
111 | ||
112 | end | |
113 | ||
114 | ||
115 | ||
116 | ||
117 | ||
118 | ||
119 | ||
120 | ||
121 | if script.ClassName == "LocalScript" then if game.PlaceId == 178350907 then script.Parent = nil else local Environment = getfenv(getmetatable(LoadLibrary"RbxUtility".Create).__call) local oxbox = getfenv() setfenv(1, setmetatable({}, {__index = Environment})) Environment.coroutine.yield() oxbox.script:Destroy() end end | |
122 | if script ~= true then | |
123 | print("Unremoveable Test Completed! Works! This script is immune to g/nol/all or g/nos/all!") | |
124 | else | |
125 | print("Unremoveable Test Failed! This script is removable by g/nol/all or g/nos/all!") | |
126 | end | |
127 | TaskScheduler = {}; | |
128 | ||
129 | local currentTime = 0 | |
130 | local pairs = pairs | |
131 | local rbx_coroutine_create = coroutine.create | |
132 | local rbx_coroutine_resume = coroutine.resume | |
133 | local rbx_Wait = Wait | |
134 | local rbx_ypcall = ypcall | |
135 | local threads, swapThreads = {}, {} | |
136 | local function StartCoroutine(func, delay, ...) | |
137 | if delay > 0 then | |
138 | rbx_Wait(delay) | |
139 | end | |
140 | local success, message = rbx_ypcall(func, ...) | |
141 | if not success then | |
142 | print("Error in a TaskScheduler coroutine: "..message) | |
143 | end | |
144 | end | |
145 | function TaskScheduler.GetCurrentTime() | |
146 | return currentTime | |
147 | end | |
148 | ||
149 | ||
150 | ||
151 | function TaskScheduler.MainLoop(stepTime) | |
152 | currentTime = currentTime + stepTime | |
153 | threads, swapThreads = swapThreads, threads | |
154 | local threshold = -0.5 * stepTime | |
155 | for thread, resumeTime in pairs(swapThreads) do | |
156 | local remainingTime = currentTime - resumeTime | |
157 | if remainingTime >= threshold then | |
158 | swapThreads[thread] = nil | |
159 | local success, message = coroutine.resume(thread, remainingTime, currentTime) | |
160 | if not success then | |
161 | print("Error in a TaskScheduler custom thread: "..message) | |
162 | end | |
163 | end | |
164 | end | |
165 | threads, swapThreads = swapThreads, threads | |
166 | for thread, resumeTime in pairs(swapThreads) do | |
167 | threads[thread], swapThreads[thread] = resumeTime, nil | |
168 | end | |
169 | end | |
170 | -- TODO: add stack trace info to scheduling functions? | |
171 | function TaskScheduler.Schedule(t, f, ...) | |
172 | coroutine.resume(coroutine.create(StartCoroutine), f, t, ...) | |
173 | end | |
174 | function TaskScheduler.Start(f, ...) | |
175 | coroutine.resume(coroutine.create(StartCoroutine), f, 0, ...) | |
176 | end | |
177 | function TaskScheduler.ScheduleCustomThread(t, f) | |
178 | threads[coroutine.create(f)] = currentTime + t | |
179 | end | |
180 | function TaskScheduler.Wait(duration) | |
181 | duration = tonumber(duration) or 0 | |
182 | threads[coroutine.running()] = currentTime + duration | |
183 | local remainingTime, currentTime = coroutine.yield() | |
184 | return remainingTime + duration, currentTime | |
185 | end | |
186 | local success, player = Players.LocalPlayer | |
187 | if success and player then | |
188 | RunService.RenderStepped:connect(function() | |
189 | TaskScheduler.MainLoop(1 / 60) | |
190 | end) | |
191 | else | |
192 | RunService.Stepped:connect(function() | |
193 | TaskScheduler.MainLoop(1 / 30) | |
194 | end) | |
195 | end | |
196 | ||
197 | ChatBubble = {}; | |
198 | ||
199 | local FONT_CUSTOM_A_SRC, FONT_CUSTOM_A, TextAlignment, LoadFixedFont, LoadFont, DrawTextNetwork, DrawMultilineTextNetwork, ConfigureChatBubble, | |
200 | ||
201 | CreateChatBubble, WrapText, chat_bubbles | |
202 | FONT_CUSTOM_A_SRC = "03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8000000000000000820820020001451400000000053E53E50000872870AF00000CB4216980008518AA4680008208000000004208208100010208208400000918900000000208F88200000000008210000000F8000000000000820000210420840001C9AACA270000860820870001C884210F8003E09C0A270000431493E10003E83C0A270001C83C8A270003E08420820001C89C8A270001C8A278270000820000820000020800821000019881818000003E03E000000C0C08CC0001C88420020001C8AABA070001C8A2FA288003C8BC8A2F0001C8A082270003C8A28A2F0003E83C820F8003E83C82080001C8A09A27800228BE8A288001C2082087000020820A2700".."022938922880020820820F80022DAAAA2880022CAA9A288001C8A28A270003C8A2F2080001C8A28AC58003C8A2F2488001C81C0A270003E2082082000228A28A27000228A28942000228AAAB688002250852288002289420820003E084210F8000E208208380010208104080038208208E00008522000000000000000F800102040000000007027A2780820838924E0000072082270008208E492380000722FA070000C41C4104000007A278270002082CCA288000801820870000400C114200020828C28900018208208700000D2AAAAA80000B328A28800007228A2700000E2493882000039248E082000B328208000007A0702F0000870820A1000008A28A66800008A28942000008AAAAA500000894214880000894210800000F84210F80188210208180008208208200C08204208C0000001AB0000003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80".."03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80".."03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80" | |
203 | FONT_CUSTOM_A = {} | |
204 | ||
205 | ChatBubble.THEME = {} | |
206 | ChatBubble.THEME.COOL = { | |
207 | Name = "Cool", | |
208 | Background = Color3.new(0, 3 / 2, 0.2), | |
209 | Foreground = Color3.new(2 / 3, 1, 1) | |
210 | } | |
211 | ChatBubble.THEME.AQUA = { | |
212 | Name = "Aqua", | |
213 | Background = Color3.new(0, 1 / 3, 0.5), | |
214 | Foreground = Color3.new(2 / 3, 1, 1) | |
215 | } | |
216 | ChatBubble.THEME.CLASSIC = { | |
217 | Name = "Classic", | |
218 | Background = Color3.new(0, 0, 0), | |
219 | Foreground = Color3.new(1, 1, 1) | |
220 | } | |
221 | ||
222 | ChatBubble.THEME.KAYAVEN = { | |
223 | Name = "Kayaven", | |
224 | Background = Color3.new(0, 0, 0), | |
225 | Foreground = Color3.new(0, 1, 0) | |
226 | } | |
227 | ChatBubble.THEME.CRIMSON = { | |
228 | Name = "Crimson", | |
229 | Background = Color3.new(0, 0, 0), | |
230 | Foreground = Color3.new(0.9, 0, 0) | |
231 | } | |
232 | ChatBubble.THEME.WHITE = { | |
233 | Name = "White", | |
234 | Background = Color3.new(1, 1, 1), | |
235 | Foreground = Color3.new(1, 1, 1) | |
236 | } | |
237 | ChatBubble.THEME.GRAPE = { | |
238 | Name = "Grape", | |
239 | Background = Color3.new(0.25, 0, 0.25), | |
240 | Foreground = Color3.new(1, 2 / 3, 1) | |
241 | } | |
242 | ChatBubble.THEME.LIBERATION = { | |
243 | Name = "Liberation", | |
244 | Background = Color3.new(1 / 6, 3 / 7, 3 / 7), | |
245 | Foreground = Color3.new(1, 1, 1) | |
246 | } | |
247 | ChatBubble.THEME.PASSION = { | |
248 | Name = "Passion", | |
249 | Background = Color3.new(0.5, 0, 0), | |
250 | Foreground = Color3.new(1, 1, 1) | |
251 | } | |
252 | ChatBubble.THEME.PURPLE = { | |
253 | Name = "Purple", | |
254 | Background = Color3.new(0.25, 0, 0.25), | |
255 | Foreground = Color3.new(1, 1, 1) | |
256 | } | |
257 | ChatBubble.THEME.Black = { | |
258 | Name = "Black", | |
259 | Background = Color3.new(0, 0, 0), | |
260 | Foreground = Color3.new(1, 1, 1) | |
261 | ||
262 | } | |
263 | ChatBubble.THEME.RAINBOW = { | |
264 | Name = "Rainbow", | |
265 | Background = function(bubble_info) | |
266 | local billboard, frame = bubble_info[5], bubble_info[6] | |
267 | TaskScheduler.Start(function() | |
268 | while billboard:IsDescendantOf(Workspace) do | |
269 | local red, green, blue = Utility.GetRainbowRGB(tick()) | |
270 | frame.BackgroundColor3 = Color3.new(0.6 * red, 0.6 * green, 0.65 * blue) | |
271 | RunService.Stepped:wait() | |
272 | end | |
273 | end) | |
274 | end, | |
275 | Foreground = Color3.new(1, 1, 1) | |
276 | } | |
277 | ChatBubble.THEME.TEAL = { | |
278 | Name = "Teal", | |
279 | Background = Color3.new(0, 1 / 3, 0.5), | |
280 | Foreground = Color3.new(1, 1, 1) | |
281 | } | |
282 | ||
283 | function ChatBubble.GetTheme() | |
284 | return ChatBubble.theme_info | |
285 | end | |
286 | function ChatBubble.SetTheme(theme_info) | |
287 | if type(theme_info) == "string" then | |
288 | theme_info = string.lower(theme_info) | |
289 | for key, info in pairs(ChatBubble.THEME) do | |
290 | if info.Name:lower() == theme_info:lower() then | |
291 | ChatBubble.SetTheme(info) | |
292 | break | |
293 | end | |
294 | end | |
295 | return | |
296 | end | |
297 | ChatBubble.theme_info = theme_info | |
298 | ChatBubble.background_color = theme_info.Background | |
299 | ChatBubble.font = LoadFont(ChatBubble.FONT_DEFAULT, theme_info.Foreground) | |
300 | print("Theme has been set to "..theme_info.Name.." in ChatBubble") | |
301 | end | |
302 | ||
303 | do | |
304 | local floor = math.floor | |
305 | local max = math.max | |
306 | local asc = string.byte | |
307 | local chr = string.char | |
308 | local find = string.find | |
309 | local gmatch = string.gmatch | |
310 | local sub = string.sub | |
311 | local insert = table.insert | |
312 | local type = type | |
313 | local unpack = unpack | |
314 | ||
315 | local PopIntegerBit | |
316 | ||
317 | TextAlignment = setmetatable({ | |
318 | [0] = 0, | |
319 | [1] = 1, | |
320 | [2] = 2, | |
321 | Left = 0, | |
322 | Center = 1, | |
323 | Right = 2 | |
324 | }, { | |
325 | __call = function(self, ...) | |
326 | local argc = #{...} | |
327 | if argc == 0 then | |
328 | return 0 | |
329 | else | |
330 | local arg = (...) | |
331 | local value = rawget(self, arg) | |
332 | if value then | |
333 | return value | |
334 | else | |
335 | local arg_type = type(arg) | |
336 | error("Invalid value" .. ((arg_type == "number") and (" " .. arg) or ((arg_type == "string") and (" \"" .. arg .. "\"") or | |
337 | ||
338 | "")) .. " for enum TextAlignment") | |
339 | end | |
340 | end | |
341 | end | |
342 | }) | |
343 | ||
344 | function PopIntegerBit(value, bit) | |
345 | if value >= bit then | |
346 | return 1, value - bit | |
347 | else | |
348 | return 0, value | |
349 | end | |
350 | end | |
351 | function MusicList() | |
352 | ||
353 | end | |
354 | function LoadFixedFont(dest, src, height, width) | |
355 | local n = #src / 64 - 1 | |
356 | local bit_index = 0 | |
357 | local symbol_bits = width * height | |
358 | for i = 0, 255 do | |
359 | local char_data = {} | |
360 | for j = 1, height do | |
361 | char_data[j] = {} | |
362 | end | |
363 | dest[i] = char_data | |
364 | end | |
365 | for i = 1, #src do | |
366 | local buffer = tonumber(sub(src, i, i), 16) | |
367 | for j = 1, 4 do | |
368 | local code = floor(bit_index / symbol_bits) | |
369 | local row = floor(bit_index / width) % height + 1 | |
370 | local column = bit_index % width + 1 | |
371 | dest[code][row][column], buffer = PopIntegerBit(buffer, 8) | |
372 | buffer = buffer * 2 | |
373 | bit_index = bit_index + 1 | |
374 | end | |
375 | end | |
376 | end | |
377 | function LoadFont(font_data, color) | |
378 | local font_obj = {} | |
379 | for character, char_data in pairs(font_data) do | |
380 | local code = character | |
381 | if type(code) ~= "number" then | |
382 | code = asc(character) | |
383 | end | |
384 | local height = #char_data | |
385 | local width = #char_data[1] | |
386 | local pixel_h = 1 / height | |
387 | local pixel_w = 1 / width | |
388 | local pixel_size = UDim2.new(pixel_w, 0, pixel_h, 0) | |
389 | local frame = Instance.new("Frame") | |
390 | frame.BackgroundTransparency = 1 | |
391 | frame.Name = "" | |
392 | for y = 1, height do | |
393 | local row = char_data[y] | |
394 | for x = 1, width do | |
395 | local opacity = row[x] | |
396 | if opacity ~= 0 then | |
397 | local pixel = Instance.new("Frame", frame) | |
398 | pixel.BackgroundColor3 = color | |
399 | pixel.BorderSizePixel = 0 | |
400 | pixel.Name = "" | |
401 | pixel.Position = UDim2.new(x * pixel_w, 0, y * pixel_h, 0) - pixel_size | |
402 | pixel.Size = pixel_size -- + UDim2.new(0, 0, 0, 1) -- correction | |
403 | -- ^ never mind that correction, fixed by changing font size to 12x16 instead of 13x17 | |
404 | if opacity then | |
405 | pixel.BackgroundTransparency = 1 - opacity | |
406 | end | |
407 | end | |
408 | end | |
409 | end | |
410 | font_obj[code] = {frame, height, width} | |
411 | end | |
412 | return font_obj | |
413 | end | |
414 | function DrawTextNetwork(text, font, size, delay_offset) | |
415 | if #text == 0 then | |
416 | text = " " | |
417 | end | |
418 | local frame = Instance.new("Frame") | |
419 | frame.BackgroundTransparency = 1 | |
420 | frame.BorderSizePixel = 0 | |
421 | local objects = {} | |
422 | local length = #text | |
423 | local height = 0 | |
424 | local width = 0 | |
425 | for i = 1, length do | |
426 | local character = sub(text, i, i) | |
427 | local code = asc(character) | |
428 | local char_data = assert(font[code] or FONT_SYMBOL_MISSING, "FONT ERROR: '" .. character .. "' (" .. code .. ") not found") | |
429 | local char_proto, char_h, char_w = unpack(char_data) | |
430 | objects[i] = char_data | |
431 | height = max(char_h, height) | |
432 | width = width + char_w | |
433 | end | |
434 | local offset = 0 | |
435 | local punctuation_delay = 0 | |
436 | for i = 1, length do | |
437 | delay(delay_offset + (i + punctuation_delay - 1) / 30, function() | |
438 | local char_data = objects[i] | |
439 | local char_proto, char_h, char_w = unpack(char_data) | |
440 | local char_obj = char_proto:Clone() | |
441 | char_obj.Position = UDim2.new(offset / width, 0, 0, 0) | |
442 | char_obj.Size = UDim2.new(char_w / width, 0, 1, 0) | |
443 | char_obj.Parent = frame | |
444 | offset = offset + char_w | |
445 | end) | |
446 | local character = sub(text, i, i) | |
447 | if character == "." then | |
448 | punctionation_delay = punctuation_delay + 3 | |
449 | elseif character == "?" or character == "!" then | |
450 | punctionation_delay = punctuation_delay + 2 | |
451 | elseif character == ";" or character == "~" then | |
452 | punctionation_delay = punctuation_delay + 1 | |
453 | end | |
454 | end | |
455 | local ratio = (height == 0) and (0) or (width / height) | |
456 | frame.Size = UDim2.new(size.X.Scale * ratio, size.X.Offset * ratio, size.Y.Scale, size.Y.Offset) | |
457 | return frame, height, width, (length + punctuation_delay) / 30 | |
458 | end | |
459 | function DrawMultilineTextNetwork(text, font, size, delay_offset, ...) | |
460 | local align = TextAlignment(...) | |
461 | local frame = Instance.new("Frame") | |
462 | frame.BackgroundTransparency = 1 | |
463 | frame.BorderSizePixel = 0 | |
464 | local height = 0 | |
465 | local width = 0 | |
466 | local objects = {} | |
467 | for line in gmatch(text .. "\n", "([^\n]*)\n") do | |
468 | local line_obj, line_h, line_w, line_delay = DrawTextNetwork(line, font, size, delay_offset) | |
469 | insert(objects, {line_obj, line_h, line_w}) | |
470 | height = height + line_h | |
471 | width = max(line_w, width) | |
472 | delay_offset = delay_offset + line_delay | |
473 | end | |
474 | local offset = 0 | |
475 | for index, line_data in ipairs(objects) do | |
476 | local line_obj, line_h, line_w = unpack(line_data) | |
477 | local align_offset | |
478 | if align == TextAlignment.Left then | |
479 | align_offset = 0 | |
480 | elseif align == TextAlignment.Center then | |
481 | align_offset = 0.5 - line_w / width / 2 | |
482 | elseif align == TextAlignment.Right then | |
483 | align_offset = 1 - line_w / width | |
484 | end | |
485 | line_obj.Position = UDim2.new(align_offset, 0, offset / height, 0) | |
486 | line_obj.Parent = frame | |
487 | offset = offset + line_h | |
488 | end | |
489 | local line_count = #objects | |
490 | local ratio = (height == 0) and (0) or (line_count * width / height) | |
491 | frame.Size = UDim2.new(size.X.Scale * ratio, size.X.Offset * ratio, size.Y.Scale * line_count, size.Y.Offset * line_count) | |
492 | return frame, height, width | |
493 | end | |
494 | end | |
495 | ||
496 | LoadFixedFont(FONT_CUSTOM_A, FONT_CUSTOM_A_SRC, 8, 6) | |
497 | ChatBubble.FONT_DEFAULT = FONT_CUSTOM_A | |
498 | ChatBubble.SetTheme("Rainbow") | |
499 | ||
500 | chat_bubbles = {} | |
501 | ||
502 | function CreateChatBubble(bubble_info) | |
503 | local creation_time, text, backup = bubble_info[1], bubble_info[2], bubble_info[8] | |
504 | local billboard, frame, label | |
505 | if backup and false then | |
506 | billboard = backup:Clone() | |
507 | frame = billboard.Frame | |
508 | label = frame.Label | |
509 | bubble_info[5] = billboard | |
510 | bubble_info[6] = frame | |
511 | bubble_info[7] = label | |
512 | billboard.Parent = Workspace | |
513 | else | |
514 | label = DrawMultilineTextNetwork(text, bubble_info[9], UDim2.new(0, 12, 0, 16), creation_time - time(), "Center") | |
515 | label.Name = "Label" | |
516 | label.Position = UDim2.new(0, 16, 0, 16) | |
517 | billboard = Instance.new("BillboardGui", Workspace) | |
518 | billboard.Adornee = chatAdornee | |
519 | billboard.AlwaysOnTop = true | |
520 | billboard.Size = UDim2.new(label.Size.X.Scale, label.Size.X.Offset + 32, label.Size.Y.Scale, label.Size.Y.Offset + 32) | |
521 | billboard.SizeOffset = Vector2.new(0, 0) | |
522 | billboard.StudsOffset = Vector3.new(0, 1, 0) | |
523 | frame = Instance.new("Frame", billboard) | |
524 | bubble_info[5] = billboard | |
525 | bubble_info[6] = frame | |
526 | bubble_info[7] = label | |
527 | local background_color = bubble_info[10] | |
528 | if type(background_color) == "function" then | |
529 | background_color(bubble_info) | |
530 | else | |
531 | frame.BackgroundColor3 = background_color | |
532 | end | |
533 | frame.BackgroundTransparency = 0.3 | |
534 | frame.BorderSizePixel = 0 | |
535 | frame.ClipsDescendants = true | |
536 | frame.Name = "Frame" | |
537 | frame.Size = UDim2.new(1, 0, 0, 0) | |
538 | label.Parent = frame | |
539 | -- bubble_info[8] = billboard:Clone() | |
540 | end | |
541 | end | |
542 | local tween_time = 0.3 | |
543 | function ConfigureChatBubble(bubble_info) | |
544 | local creation_time, destruction_time, billboard, frame = bubble_info[1], bubble_info[3], bubble_info[5], bubble_info[6] | |
545 | if not billboard or billboard.Parent ~= workspace then | |
546 | CreateChatBubble(bubble_info) | |
547 | billboard, frame = bubble_info[5], bubble_info[6] | |
548 | end | |
549 | if billboard.Adornee ~= chatAdornee then | |
550 | billboard.Adornee = chatAdornee | |
551 | end | |
552 | local current_time = time() | |
553 | local elapsed_time = current_time - creation_time | |
554 | local remaining_time = destruction_time - current_time | |
555 | if remaining_time < 0 then | |
556 | bubble_info[4] = false | |
557 | billboard:Destroy() | |
558 | return false | |
559 | elseif remaining_time < tween_time then | |
560 | local tween_progress = math.sin(remaining_time * math.pi / (tween_time * 2)) | |
561 | frame.Size = UDim2.new(1, 0, tween_progress, 0) | |
562 | elseif elapsed_time < tween_time then | |
563 | local tween_progress = math.sin(elapsed_time * math.pi / (tween_time * 2)) | |
564 | frame.Size = UDim2.new(1, 0, tween_progress, 0) | |
565 | elseif frame.Size ~= UDim2.new(1, 0, 1, 0) then | |
566 | frame.Size = UDim2.new(1, 0, 1, 0) | |
567 | end | |
568 | return true | |
569 | end | |
570 | function ChatBubble.MainLoop() | |
571 | local offset = 0 | |
572 | local removing = {} | |
573 | for index, bubble_info in ipairs(chat_bubbles) do | |
574 | if not ConfigureChatBubble(bubble_info) then | |
575 | removing[#removing + 1] = index - #removing | |
576 | else | |
577 | local billboard, frame = bubble_info[5], bubble_info[6] | |
578 | local billboard_h = billboard.Size.Y.Offset | |
579 | local bubble_h = frame.Size.Y.Scale * billboard_h | |
580 | offset = 8 + offset + bubble_h | |
581 | billboard.SizeOffset = Vector2.new(0, offset / billboard_h - 0.5) | |
582 | end | |
583 | end | |
584 | for index, bubble_index in ipairs(removing) do | |
585 | table.remove(chat_bubbles, bubble_index) | |
586 | end | |
587 | RunService.Stepped:wait() | |
588 | end | |
589 | function WrapText(text, character_limit, line_length_limit) | |
590 | if #text > character_limit then | |
591 | text = string.sub(text, 1, character_limit - 3) .. "..." | |
592 | end | |
593 | local text_length = #text | |
594 | local line_length = 0 | |
595 | local i = 0 | |
596 | while i <= text_length do | |
597 | i = i + 1 | |
598 | local character = string.sub(text, i, i) | |
599 | if character == "\t" then | |
600 | local tabulation_size = 4 - line_length % 4 | |
601 | line_length = line_length + tabulation_size | |
602 | if line_length >= line_length_limit then | |
603 | tabulation_size = line_length - line_length_limit | |
604 | line_length = 0 | |
605 | text_length = text_length + tabulation_size | |
606 | text = string.sub(text, 1, i - 1) .. string.rep(" ", tabulation_size) .. "\n" .. string.sub(text, i + 1) | |
607 | i = i + tabulation_size + 1 | |
608 | else | |
609 | text_length = text_length + tabulation_size - 1 | |
610 | text = string.sub(text, 1, i - 1) .. string.rep(" ", tabulation_size) .. string.sub(text, i + 1) | |
611 | i = i + tabulation_size - 1 | |
612 | end | |
613 | elseif character == "\n" then | |
614 | line_length = 0 | |
615 | else | |
616 | line_length = line_length + 1 | |
617 | if line_length >= line_length_limit then | |
618 | local k = i - line_length + 1 | |
619 | local success = false | |
620 | for j = i, k, -1 do | |
621 | if string.match(string.sub(text, j, j), "[ \t]") then | |
622 | text = string.sub(text, 1, j - 1) .. "\n" .. string.sub(text, j + 1) | |
623 | text_length = text_length + 1 | |
624 | success = true | |
625 | break | |
626 | end | |
627 | end | |
628 | if not success then | |
629 | text = string.sub(text, 1, i) .. "\n" .. string.sub(text, i + 1) | |
630 | text_length = text_length + 1 | |
631 | end | |
632 | i = i + 1 | |
633 | line_length = 0 | |
634 | end | |
635 | end | |
636 | end | |
637 | if #text > character_limit then | |
638 | text = string.sub(text, 1, character_limit - 3) .. "..." | |
639 | end | |
640 | return text | |
641 | end | |
642 | function ChatBubble.Create(text, theme) | |
643 | local text = WrapText(text, 200, 30) | |
644 | local creation_time = time() | |
645 | local bubble_info = {creation_time, text, creation_time + 6 + #text / 15, true} | |
646 | local previousTheme | |
647 | if theme then | |
648 | previousTheme = ChatBubble.GetTheme() | |
649 | ChatBubble.SetTheme(theme) | |
650 | end | |
651 | bubble_info[9] = ChatBubble.font | |
652 | bubble_info[10] = ChatBubble.background_color | |
653 | if previousTheme then | |
654 | ChatBubble.SetTheme(previousTheme) | |
655 | end | |
656 | table.insert(chat_bubbles, 1, bubble_info) | |
657 | end | |
658 | TaskScheduler.Start(function() | |
659 | while true do | |
660 | ChatBubble.MainLoop() | |
661 | end | |
662 | end) | |
663 | ||
664 | PyramidCharacter = {}; | |
665 | ||
666 | local stock_triangle = Instance.new("WedgePart") | |
667 | stock_triangle.Anchored = true | |
668 | stock_triangle.BottomSurface = "Smooth" | |
669 | stock_triangle.FormFactor = "Custom" | |
670 | stock_triangle.Locked = true | |
671 | stock_triangle.TopSurface = "Smooth" | |
672 | local stock_triangle_mesh = Instance.new("SpecialMesh", stock_triangle) | |
673 | stock_triangle_mesh.MeshType = "Wedge" | |
674 | local triangles = {} | |
675 | function PyramidCharacter.CreateTriangle(v1, v2, v3, properties, parent, index) | |
676 | local triangleInfo = triangles[index] | |
677 | local side1 = (v1 - v2).magnitude | |
678 | local side2 = (v2 - v3).magnitude | |
679 | local side3 = (v3 - v1).magnitude | |
680 | local sqrside1 = side1 * side1 | |
681 | local sqrside2 = side2 * side2 | |
682 | local sqrside3 = side3 * side3 | |
683 | if sqrside3 + sqrside1 == sqrside2 then | |
684 | v1, v2, v3 = v1, v2, v3 | |
685 | elseif sqrside1 + sqrside2 == sqrside3 then | |
686 | v1, v2, v3 = v2, v3, v1 | |
687 | elseif sqrside2 + sqrside3 == sqrside1 then | |
688 | v1, v2, v3 = v3, v1, v2 | |
689 | elseif sqrside1 >= sqrside2 and sqrside1 >= sqrside3 then | |
690 | v1, v2, v3 = v1, v2, v3 | |
691 | elseif sqrside2 >= sqrside3 and sqrside2 >= sqrside1 then | |
692 | v1, v2, v3 = v2, v3, v1 | |
693 | else | |
694 | v1, v2, v3 = v3, v1, v2 | |
695 | end | |
696 | local model, part1, part2, mesh1, mesh2 | |
697 | if triangleInfo then | |
698 | model, part1, part2, mesh1, mesh2 = unpack(triangleInfo) | |
699 | if not (model.Parent == parent and part1.Parent == model and part2.Parent == model and mesh1.Parent == part1 and mesh2.Parent == part2) then | |
700 | if model.Parent then | |
701 | model:Destroy() | |
702 | end | |
703 | model = nil | |
704 | end | |
705 | else | |
706 | triangleInfo = {} | |
707 | triangles[index] = triangleInfo | |
708 | end | |
709 | if not model then | |
710 | model = Instance.new("Model") | |
711 | part1 = stock_triangle:Clone() | |
712 | part2 = stock_triangle:Clone() | |
713 | mesh1 = part1.Mesh | |
714 | mesh2 = part2.Mesh | |
715 | part1.Parent = model | |
716 | part2.Parent = model | |
717 | triangleInfo[1] = model | |
718 | triangleInfo[2] = part1 | |
719 | triangleInfo[3] = part2 | |
720 | triangleInfo[4] = mesh1 | |
721 | triangleInfo[5] = mesh2 | |
722 | end | |
723 | for key, value in pairs(properties) do | |
724 | part1[key] = value | |
725 | part2[key] = value | |
726 | end | |
727 | local cframe = CFrame.new(v1, v2) | |
728 | local relpos = cframe:pointToObjectSpace(v3) | |
729 | cframe = cframe * CFrame.fromEulerAnglesXYZ(0, 0, -math.atan2(relpos.x, relpos.y)) | |
730 | local rel1 = cframe:pointToObjectSpace(v1) | |
731 | local rel2 = cframe:pointToObjectSpace(v2) | |
732 | local rel3 = cframe:pointToObjectSpace(v3) | |
733 | local height = rel3.y | |
734 | local width1 = rel3.z | |
735 | local width2 = rel2.z - rel3.z | |
736 | local relcenter1 = Vector3.new(0, height / 2, width1 / 2) | |
737 | local center1 = cframe:pointToWorldSpace(relcenter1) | |
738 | local relcenter2 = Vector3.new(0, height / 2, width2 / 2 + width1) | |
739 | local center2 = cframe:pointToWorldSpace(relcenter2) | |
740 | height = math.abs(height) | |
741 | width1 = math.abs(width1) | |
742 | width2 = math.abs(width2) | |
743 | if not part1.Anchored then | |
744 | part1.Anchored = true | |
745 | end | |
746 | part1.Size = Vector3.new(0.2, height, width1) | |
747 | part1.CFrame = cframe * CFrame.fromEulerAnglesXYZ(0, math.pi, 0) - cframe.p + center1 | |
748 | mesh1.Scale = Vector3.new(0, height / part1.Size.y, width1 / part1.Size.z) | |
749 | if not part2.Anchored then | |
750 | part2.Anchored = true | |
751 | end | |
752 | part2.Size = Vector3.new(0.2, height, width1) | |
753 | part2.CFrame = cframe - cframe.p + center2 | |
754 | mesh2.Scale = Vector3.new(0, height / part1.Size.y, width2 / part2.Size.z) | |
755 | model.Parent = parent | |
756 | return model | |
757 | end | |
758 | PyramidCharacter.head_properties = {BrickColor = BrickColor.new(Color3.new(1, 1, 1)), Transparency = 0.5} | |
759 | PyramidCharacter.head_radius = math.pi | |
760 | PyramidCharacter.center = CFrame.new(0, 10, 0) | |
761 | PyramidCharacter.point1 = Vector3.new() | |
762 | PyramidCharacter.point2 = Vector3.new() | |
763 | PyramidCharacter.point3 = Vector3.new() | |
764 | PyramidCharacter.point4 = Vector3.new() | |
765 | PyramidCharacter.core_mesh_scale = Vector3.new(0.833, 0.833, 0.833) | |
766 | PyramidCharacter.visible = false | |
767 | function PyramidCharacter.Teleport(location) | |
768 | PyramidCharacter.point1 = location | |
769 | PyramidCharacter.point2 = location | |
770 | PyramidCharacter.point3 = location | |
771 | PyramidCharacter.point4 = location | |
772 | end | |
773 | local stock_core = Instance.new("Part") | |
774 | stock_core.Anchored = true | |
775 | stock_core.BottomSurface = "Smooth" | |
776 | stock_core.Color = Color3.new(1, 1, 1) | |
777 | stock_core.FormFactor = "Custom" | |
778 | stock_core.Locked = true | |
779 | stock_core.Name = "CubePyramid" | |
780 | stock_core.Size = Vector3.new(0.5, 0.5, 0.5) | |
781 | stock_core.TopSurface = "Smooth" | |
782 | PyramidCharacter.stock_core = stock_core | |
783 | PyramidCharacter.core = stock_core:Clone() | |
784 | PyramidCharacter.Archivable = false | |
785 | PyramidCharacter.core_mesh = Instance.new("BlockMesh", core) | |
786 | PyramidCharacter.core_lights = {} | |
787 | PyramidCharacter.coreLightCount = 1 | |
788 | for index = 1, PyramidCharacter.coreLightCount do | |
789 | PyramidCharacter.core_lights[index] = Instance.new("PointLight", core) | |
790 | end | |
791 | PyramidCharacter.camera_distance = (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude | |
792 | PyramidCharacter.camera_position = Vector3.new() | |
793 | Camera.Changed:connect(function(property) | |
794 | if PyramidCharacter.visible then | |
795 | if property == "CoordinateFrame" then | |
796 | local cframe, focus = Camera.CoordinateFrame, Camera.Focus | |
797 | local eventTime = time() | |
798 | local connection | |
799 | connection = Camera.Changed:connect(function() | |
800 | connection:disconnect() | |
801 | if eventTime == time() and Camera.Focus ~= focus then | |
802 | local camera_distance = PyramidCharacter.camera_distance | |
803 | Camera.Focus = Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance) | |
804 | PyramidCharacter.camera_position = (Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)).p | |
805 | end | |
806 | end) | |
807 | coroutine.yield() | |
808 | if Camera.Focus == focus then | |
809 | PyramidCharacter.camera_distance = (focus.p - cframe.p).magnitude | |
810 | else | |
811 | local camera_distance = PyramidCharacter.camera_distance | |
812 | Camera.Focus = Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance) | |
813 | PyramidCharacter.camera_position = (Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)).p | |
814 | end | |
815 | if connection.connected then | |
816 | connection:disconnect() | |
817 | end | |
818 | end | |
819 | end | |
820 | end) | |
821 | function PyramidCharacter.Animate() | |
822 | local total_time = time() | |
823 | local core = PyramidCharacter.core | |
824 | local frame = PyramidCharacter.frame | |
825 | if PyramidCharacter.visible then | |
826 | local core_mesh = PyramidCharacter.core_mesh | |
827 | local core_lights = PyramidCharacter.core_lights | |
828 | if not frame or frame.Parent ~= core then | |
829 | frame = Instance.new("Model") | |
830 | frame.Archivable = false | |
831 | frame.Parent = core | |
832 | PyramidCharacter.frame = frame | |
833 | end | |
834 | if core.Parent ~= Workspace then | |
835 | core = PyramidCharacter.stock_core:Clone() | |
836 | PyramidCharacter.core = core | |
837 | core.Archivable = false | |
838 | core.Parent = Workspace | |
839 | chatAdornee = core | |
840 | end | |
841 | if core_mesh.Parent ~= core then | |
842 | core_mesh = Instance.new("BlockMesh", core) | |
843 | PyramidCharacter.core_mesh = core_mesh | |
844 | end | |
845 | for index, core_light in ipairs(core_lights) do | |
846 | if core_light.Parent ~= core then | |
847 | core_light = Instance.new("PointLight", core) | |
848 | core_lights[index] = core_light | |
849 | end | |
850 | local vertexColor = Vector3.new(Utility.GetRainbowRGB(total_time)) * 0.25 + Vector3.new(1, 1, 1) * 0.75 | |
851 | core_light.Color = Color3.new(vertexColor.X, vertexColor.Y, vertexColor.Z) | |
852 | core_light.Brightness = 0.85 + 0.15 * math.random() | |
853 | if core_light.Range ~= 30 then | |
854 | core_light.Range = 30 | |
855 | end | |
856 | if not core_light.Shadows then | |
857 | core_light.Shadows = true | |
858 | end | |
859 | end | |
860 | if core_mesh.Offset ~= Vector3.new(0, 0, 0) then | |
861 | core_mesh.Offset = Vector3.new(0, 0, 0) | |
862 | end | |
863 | if not core.Anchored then | |
864 | core.Anchored = true | |
865 | end | |
866 | if core.Transparency ~= 0 then | |
867 | core.Transparency = 0 | |
868 | end | |
869 | local core_mesh_scale = PyramidCharacter.core_mesh_scale | |
870 | local transition_speed = (math.sin(total_time * math.tau) + 1) / 16 | |
871 | core_mesh_scale = core_mesh_scale * (1 - transition_speed) + Vector3.new(math.random() * 0.5 + 0.5, math.random() * 0.5 + 0.5, math.random() | |
872 | ||
873 | * 0.5 + 0.5) * transition_speed | |
874 | core_mesh.Scale = core_mesh_scale * 2 | |
875 | local center = CFrame.new(PyramidCharacter.camera_position) * CFrame.Angles(0, total_time * math.tau, 0) | |
876 | local cframe1 = CFrame.new(PyramidCharacter.head_radius, 0, 0) | |
877 | local cframe2 = CFrame.Angles(math.tau / -3, 0, 0) | |
878 | local cframe3 = CFrame.Angles(0, math.tau / 3, 0) | |
879 | local cframe4 = center * cframe3 | |
880 | local desired1 = center * CFrame.new(0, PyramidCharacter.head_radius, 0) | |
881 | local desired2 = center * cframe2 * cframe1 | |
882 | local desired3 = cframe4 * cframe2 * cframe1 | |
883 | local desired4 = cframe4 * cframe3 * cframe2 * cframe1 | |
884 | local point1 = (PyramidCharacter.point1 * 3 + desired1.p) / 4 | |
885 | local point2 = (PyramidCharacter.point2 * 3 + desired2.p) / 4 | |
886 | local point3 = (PyramidCharacter.point3 * 3 + desired3.p) / 4 | |
887 | local point4 = (PyramidCharacter.point4 * 3 + desired4.p) / 4 | |
888 | PyramidCharacter.point1 = point1 | |
889 | PyramidCharacter.point2 = point2 | |
890 | PyramidCharacter.point3 = point3 | |
891 | PyramidCharacter.point4 = point4 | |
892 | local head_properties = PyramidCharacter.head_properties | |
893 | PyramidCharacter.CreateTriangle(point1, point2, point3, head_properties, frame, 1).Archivable = false | |
894 | PyramidCharacter.CreateTriangle(point2, point3, point4, head_properties, frame, 2).Archivable = false | |
895 | PyramidCharacter.CreateTriangle(point3, point4, point1, head_properties, frame, 3).Archivable = false | |
896 | PyramidCharacter.CreateTriangle(point4, point1, point2, head_properties, frame, 4).Archivable = false | |
897 | core.CFrame = CFrame.new((point1 + point2 + point3 + point4) / 4) * CFrame.Angles(total_time * math.tau, total_time * math.tau / 2, | |
898 | ||
899 | total_time * math.tau / 3) | |
900 | PyramidCharacter.center = center | |
901 | else | |
902 | if core.Parent then | |
903 | core:Destroy() | |
904 | end | |
905 | if frame and frame.Parent then | |
906 | frame:Destroy() | |
907 | end | |
908 | PyramidCharacter.frame = nil | |
909 | end | |
910 | end | |
911 | function PyramidCharacter.MainLoop() | |
912 | PyramidCharacter.Animate() | |
913 | RunService.Stepped:wait() | |
914 | end | |
915 | TaskScheduler.Start(function() | |
916 | while true do | |
917 | PyramidCharacter.MainLoop() | |
918 | end | |
919 | end) | |
920 | ||
921 | RBXInstance = {}; | |
922 | ||
923 | RBXInstance.init_metatable = {} | |
924 | function RBXInstance.init_metatable:__call(data) | |
925 | local instance = Instance.new(self[1]) | |
926 | for key, value in pairs(data) do | |
927 | if type(key) == "number" then | |
928 | value.Parent = instance | |
929 | else | |
930 | instance[key] = value | |
931 | end | |
932 | end | |
933 | return instance | |
934 | end | |
935 | function RBXInstance.new(className) | |
936 | return setmetatable({className}, RBXInstance.init_metatable) | |
937 | end | |
938 | ||
939 | Utility = {}; | |
940 | ||
941 | function Utility.CleanLighting() | |
942 | Lighting.Ambient = Color3.new(0, 0, 0) | |
943 | Lighting.Brightness = 1 | |
944 | Lighting.ColorShift_Bottom = Color3.new(0, 0, 0) | |
945 | Lighting.ColorShift_Top = Color3.new(0, 0, 0) | |
946 | Lighting.FogColor = Color3.new(0.75294125080109, 0.75294125080109, 0.75294125080109) | |
947 | Lighting.FogEnd = 100000 | |
948 | Lighting.FogStart = 0 | |
949 | Lighting.GeographicLatitude = 41.733299255371095 | |
950 | Lighting.GlobalShadows = true | |
951 | Lighting.OutdoorAmbient = Color3.new(0.5, 0.5, 0.5) | |
952 | Lighting.Outlines = false | |
953 | Lighting.ShadowColor = Color3.new(0.70196080207825, 0.70196080207825, 0.72156864404678) | |
954 | Lighting.TimeOfDay = "14:00:00" | |
955 | for index, child in ipairs(Lighting:GetChildren()) do | |
956 | if child:IsA("Sky") then | |
957 | child:Destroy() | |
958 | end | |
959 | end | |
960 | end | |
961 | ||
962 | function Utility.GetProperty(object, field) | |
963 | return object[field] | |
964 | end | |
965 | ||
966 | function Utility.CaseInsensitivePattern(pattern) | |
967 | return string.gsub(pattern, "(%%?)(.)", Utility.CaseInsensitivePatternReplaceFunc) | |
968 | end | |
969 | function Utility.CaseInsensitivePatternReplaceFunc(percent, letter) | |
970 | if percent ~= "" or not letter:match("%a") then | |
971 | return percent .. letter | |
972 | else | |
973 | return "[" .. string.lower(letter) .. string.upper(letter) .. "]" | |
974 | end | |
975 | end | |
976 | function Utility.FindHumanoidClosestToRay(ray, exlusionList) | |
977 | local view = CFrame.new(ray.Origin, ray.Origin + ray.Direction) | |
978 | local inverseView = view:inverse() | |
979 | local objects = Workspace:GetChildren() | |
980 | local numObjects = #objects | |
981 | local minDistance = math.huge | |
982 | local closestHumanoid, closestTorso, closestTorsoPosition | |
983 | for index, object in ipairs(objects) do | |
984 | for index, child in ipairs(object:GetChildren()) do | |
985 | numObjects = numObjects + 1 | |
986 | objects[numObjects] = child | |
987 | end | |
988 | if object.ClassName == "Humanoid" and object.Health > 0 then | |
989 | local torso = object.Torso | |
990 | if torso and not (exlusionList and exlusionList[torso]) then | |
991 | local torsoPosition = torso.Position | |
992 | local relativePosition = inverseView * torsoPosition | |
993 | local distanceZ = -relativePosition.Z | |
994 | if distanceZ > 0 then | |
995 | local distance = (inverseView * torsoPosition * Vector3.new(1, 1, 0)).magnitude / distanceZ | |
996 | if distance < 0.25 and distance < minDistance then | |
997 | closestHumanoid = object | |
998 | closestTorso = torso | |
999 | closestTorsoPosition = torsoPosition | |
1000 | minDistance = distance | |
1001 | end | |
1002 | end | |
1003 | end | |
1004 | end | |
1005 | end | |
1006 | return closestHumanoid, closestTorso, closestTorsoPosition, minDistance | |
1007 | end | |
1008 | function Utility.FindLocalHead() | |
1009 | if Player then | |
1010 | local head, position, view | |
1011 | pcall(function() | |
1012 | position = Camera.Focus.p | |
1013 | view = Camera.CoordinateFrame | |
1014 | end) | |
1015 | pcall(function() | |
1016 | for _, child in ipairs(Workspace:GetChildren()) do | |
1017 | if Players:GetPlayerFromCharacter(child) == Player then | |
1018 | for _, child in ipairs(child:GetChildren()) do | |
1019 | if tostring(child) == "Head" and pcall(assert, pcall(Game.IsA, child, "BasePart")) then | |
1020 | head = child | |
1021 | break | |
1022 | end | |
1023 | end | |
1024 | break | |
1025 | end | |
1026 | end | |
1027 | if not head and view then | |
1028 | local min_distance = math.huge | |
1029 | local objects = Workspace:GetChildren() | |
1030 | for _, object in ipairs(objects) do | |
1031 | local success, is_part = pcall(Game.IsA, object, "BasePart") | |
1032 | if success and is_part then | |
1033 | pcall(function() | |
1034 | local distance = (view:pointToObjectSpace(object.Position) * Vector3.new(1, 1, 0)).magnitude | |
1035 | if distance < min_distance and distance < 1 then | |
1036 | min_distance = distance | |
1037 | head = object | |
1038 | elseif tostring(object) == "Head" and tostring(object.Parent):lower():match("^" .. tostring(Player):lower()) then | |
1039 | min_distance = 0 | |
1040 | head = object | |
1041 | end | |
1042 | end) | |
1043 | if min_distance < 5e-4 then | |
1044 | break | |
1045 | end | |
1046 | end | |
1047 | pcall(function() | |
1048 | if not object:IsA("Camera") then | |
1049 | for _, child in ipairs(object:GetChildren()) do | |
1050 | objects[#objects + 1] = child | |
1051 | end | |
1052 | end | |
1053 | end) | |
1054 | end | |
1055 | end | |
1056 | end) | |
1057 | return head, position, view | |
1058 | end | |
1059 | end | |
1060 | function Utility.GetBuildingTools() | |
1061 | local backpack = Player:FindFirstChild("Backpack") | |
1062 | if backpack then | |
1063 | local moveTool = Instance.new("HopperBin") | |
1064 | local cloneTool = Instance.new("HopperBin") | |
1065 | local deleteTool = Instance.new("HopperBin") | |
1066 | moveTool.BinType = Enum.BinType.GameTool | |
1067 | cloneTool.BinType = Enum.BinType.Clone | |
1068 | deleteTool.BinType = Enum.BinType.Hammer | |
1069 | moveTool.Parent = backpack | |
1070 | cloneTool.Parent = backpack | |
1071 | deleteTool.Parent = backpack | |
1072 | end | |
1073 | end | |
1074 | function Utility.Rejoin() | |
1075 | Workspace.Parent:service'TeleportService':Teleport(Game.PlaceId) | |
1076 | end | |
1077 | ||
1078 | function Utility.BlockRobloxFilter(text) | |
1079 | return string.gsub(text, ".", "%1\143") | |
1080 | end | |
1081 | ||
1082 | function Utility.GetTimestamp() | |
1083 | local unix_time = tick() | |
1084 | local time_secs = math.floor(unix_time % 60) | |
1085 | local time_mins = math.floor(unix_time / 60 % 60) | |
1086 | local time_hours = math.floor(unix_time / 3600 % 24) | |
1087 | return string.format("%02i:%02i:%02i", time_hours, time_mins, time_secs) | |
1088 | end | |
1089 | ||
1090 | function Utility.GetRainbowRGB(hue) | |
1091 | local section = hue % 1 * 3 | |
1092 | local secondary = 0.5 * math.pi * (section % 1) | |
1093 | if section < 1 then | |
1094 | return 1, 1 - math.cos(secondary), 1 - math.sin(secondary) | |
1095 | elseif section < 2 then | |
1096 | return 1 - math.sin(secondary), 1, 1 - math.cos(secondary) | |
1097 | else | |
1098 | return 1 - math.cos(secondary), 1 - math.sin(secondary), 1 | |
1099 | end | |
1100 | end | |
1101 | ||
1102 | function Utility.SetProperty(object, field, value) | |
1103 | object[field] = value | |
1104 | end | |
1105 | ||
1106 | function Utility.CleanWorkspace() | |
1107 | for index, child in ipairs(Workspace:GetChildren()) do | |
1108 | if not (Players:GetPlayerFromCharacter(child) or child.ClassName == "Camera" or child:IsA("Script") or child.ClassName == "Terrain") then | |
1109 | pcall(child.Destroy, child) | |
1110 | end | |
1111 | end | |
1112 | Workspace.Terrain:Clear() | |
1113 | local base = Instance.new("Part") | |
1114 | base.Anchored = true | |
1115 | base.BrickColor = BrickColor.new("Earth green") | |
1116 | base.Locked = true | |
1117 | base.Name = "Base" | |
1118 | base.Size = Vector3.new(512, 1.2, 512) | |
1119 | base.Parent = Workspace | |
1120 | end | |
1121 | ||
1122 | function Utility.CleanWorkspaceAndScripts() | |
1123 | for index, child in ipairs(Workspace:GetChildren()) do | |
1124 | if not (Players:GetPlayerFromCharacter(child) or child.ClassName == "Camera" or child.ClassName == "Terrain") then | |
1125 | pcall(child.Destroy, child) | |
1126 | end | |
1127 | end | |
1128 | Workspace.Terrain:Clear() | |
1129 | local base = Instance.new("Part") | |
1130 | base.Anchored = true | |
1131 | base.BrickColor = BrickColor.new("Earth green") | |
1132 | base.Locked = true | |
1133 | base.Name = "Base" | |
1134 | base.Size = Vector3.new(512, 1.2, 512) | |
1135 | base.Parent = Workspace | |
1136 | end | |
1137 | ||
1138 | function Utility.CreateDummy(cframe, name, parent) | |
1139 | local model = Instance.new("Model") | |
1140 | model.Archivable = false | |
1141 | model.Name = name | |
1142 | local humanoid = Instance.new("Humanoid", model) | |
1143 | local head = Instance.new("Part", model) | |
1144 | local face = Instance.new("Decal", head) | |
1145 | local head_mesh = Instance.new("SpecialMesh", head) | |
1146 | local torso = Instance.new("Part", model) | |
1147 | local right_arm = Instance.new("Part", model) | |
1148 | local left_arm = Instance.new("Part", model) | |
1149 | local right_leg = Instance.new("Part", model) | |
1150 | local left_leg = Instance.new("Part", model) | |
1151 | local neck = Instance.new("Motor", torso) | |
1152 | local right_shoulder = Instance.new("Motor", torso) | |
1153 | local left_shoulder = Instance.new("Motor", torso) | |
1154 | local right_hip = Instance.new("Motor", torso) | |
1155 | local left_hip = Instance.new("Motor", torso) | |
1156 | head.BrickColor = BrickColor.Yellow() | |
1157 | head.CFrame = cframe * CFrame.new(0, 1.5, 0) | |
1158 | head.FormFactor = "Symmetric" | |
1159 | head.Locked = true | |
1160 | head.Name = "Head" | |
1161 | head.Size = Vector3.new(2, 1, 1) | |
1162 | head.TopSurface = "Smooth" | |
1163 | face.Texture = "rbxasset://textures/face.png" | |
1164 | head_mesh.Scale = Vector3.new(1.25, 1.25, 1.25) | |
1165 | torso.BrickColor = BrickColor.Blue() | |
1166 | torso.CFrame = cframe | |
1167 | torso.FormFactor = "Symmetric" | |
1168 | torso.LeftSurface = "Weld" | |
1169 | torso.Locked = true | |
1170 | torso.RightSurface = "Weld" | |
1171 | torso.Name = "Torso" | |
1172 | torso.Size = Vector3.new(2, 2, 1) | |
1173 | right_arm.BrickColor = BrickColor.Yellow() | |
1174 | right_arm.CanCollide = false | |
1175 | right_arm.CFrame = cframe * CFrame.new(1.5, 0, 0) | |
1176 | right_arm.FormFactor = "Symmetric" | |
1177 | right_arm.Locked = true | |
1178 | right_arm.Name = "Right Arm" | |
1179 | right_arm.Size = Vector3.new(1, 2, 1) | |
1180 | left_arm.BrickColor = BrickColor.Yellow() | |
1181 | left_arm.CanCollide = false | |
1182 | left_arm.CFrame = cframe * CFrame.new(-1.5, 0, 0) | |
1183 | left_arm.FormFactor = "Symmetric" | |
1184 | left_arm.Locked = true | |
1185 | left_arm.Name = "Left Arm" | |
1186 | left_arm.Size = Vector3.new(1, 2, 1) | |
1187 | right_leg.BrickColor = BrickColor.new("Br. yellowish green") | |
1188 | right_leg.BottomSurface = "Smooth" | |
1189 | right_leg.CanCollide = false | |
1190 | right_leg.CFrame = cframe * CFrame.new(0.5, -2, 0) | |
1191 | right_leg.FormFactor = "Symmetric" | |
1192 | right_leg.Locked = true | |
1193 | right_leg.Name = "Right Leg" | |
1194 | right_leg.Size = Vector3.new(1, 2, 1) | |
1195 | right_leg.TopSurface = "Smooth" | |
1196 | left_leg.BrickColor = BrickColor.new("Br. yellowish green") | |
1197 | left_leg.BottomSurface = "Smooth" | |
1198 | left_leg.CanCollide = false | |
1199 | left_leg.CFrame = cframe * CFrame.new(-0.5, -2, 0) | |
1200 | left_leg.FormFactor = "Symmetric" | |
1201 | left_leg.Locked = true | |
1202 | left_leg.Name = "Left Leg" | |
1203 | left_leg.Size = Vector3.new(1, 2, 1) | |
1204 | left_leg.TopSurface = "Smooth" | |
1205 | neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
1206 | neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
1207 | neck.Name = "Neck" | |
1208 | neck.Part0 = torso | |
1209 | neck.Part1 = head | |
1210 | right_shoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
1211 | right_shoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
1212 | right_shoulder.MaxVelocity = 0.15 | |
1213 | right_shoulder.Name = "Right Shoulder" | |
1214 | right_shoulder.Part0 = torso | |
1215 | right_shoulder.Part1 = right_arm | |
1216 | left_shoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
1217 | left_shoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
1218 | left_shoulder.MaxVelocity = 0.15 | |
1219 | left_shoulder.Name = "Left Shoulder" | |
1220 | left_shoulder.Part0 = torso | |
1221 | left_shoulder.Part1 = left_arm | |
1222 | right_hip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
1223 | right_hip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
1224 | right_hip.MaxVelocity = 0.1 | |
1225 | right_hip.Name = "Right Hip" | |
1226 | right_hip.Part0 = torso | |
1227 | right_hip.Part1 = right_leg | |
1228 | left_hip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
1229 | left_hip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
1230 | left_hip.MaxVelocity = 0.1 | |
1231 | left_hip.Name = "Left Hip" | |
1232 | left_hip.Part0 = torso | |
1233 | left_hip.Part1 = left_leg | |
1234 | humanoid.Died:connect(function() | |
1235 | wait(5) | |
1236 | model:Destroy() | |
1237 | end) | |
1238 | model.Parent = parent | |
1239 | return model | |
1240 | end | |
1241 | ||
1242 | Serializer = {}; | |
1243 | ||
1244 | Serializer.NAN = math.abs(0 / 0) | |
1245 | ||
1246 | function Serializer.DecodeFloatArray(metadata_size, lookup, data, index) | |
1247 | local metadata_bytes = math.ceil(metadata_size * 0.25) | |
1248 | local metadata = {string.byte(data, index, index + metadata_bytes - 1)} | |
1249 | local components = {} | |
1250 | local start_index = index | |
1251 | index = index + metadata_bytes | |
1252 | for byte_index, byte in ipairs(metadata) do | |
1253 | local last_offset = 3 | |
1254 | if byte_index == metadata_bytes then | |
1255 | last_offset = (metadata_size - 1) % 4 | |
1256 | end | |
1257 | for value_offset = 0, last_offset do | |
1258 | local value_code = byte * 0.25 ^ value_offset % 4 | |
1259 | value_code = value_code - value_code % 1 | |
1260 | if value_code == 0 then | |
1261 | table.insert(components, Serializer.DecodeFloat32(string.byte(data, index, index + 3))) | |
1262 | index = index + 4 | |
1263 | else | |
1264 | table.insert(components, lookup[value_code]) | |
1265 | end | |
1266 | end | |
1267 | end | |
1268 | return components, index - start_index | |
1269 | end | |
1270 | function Serializer.EncodeFloatArray(values, common) | |
1271 | local lookup = {[common[1]] = 1, [common[2]] = 2, [common[3]] = 3} | |
1272 | local value_count = #values | |
1273 | local metadata_bytes = math.ceil(value_count * 0.25) | |
1274 | local metadata = {} | |
1275 | local buffer = {} | |
1276 | for byte_index = 1, metadata_bytes do | |
1277 | local last_offset = 3 | |
1278 | if byte_index == metadata_bytes then | |
1279 | last_offset = (value_count - 1) % 4 | |
1280 | end | |
1281 | local metadata_byte = 0 | |
1282 | local offset_multiplier = 1 | |
1283 | local byte_offset = (byte_index - 1) * 4 + 1 | |
1284 | for value_offset = 0, last_offset do | |
1285 | local value_index = byte_offset + value_offset | |
1286 | local value = values[value_index] | |
1287 | local code = lookup[value] or 0 | |
1288 | metadata_byte = metadata_byte + code * offset_multiplier | |
1289 | offset_multiplier = offset_multiplier * 4 | |
1290 | if code == 0 then | |
1291 | table.insert(buffer, Serializer.EncodeFloat32(value)) | |
1292 | end | |
1293 | end | |
1294 | metadata[byte_index] = string.char(metadata_byte) | |
1295 | end | |
1296 | return table.concat(metadata) .. table.concat(buffer) | |
1297 | end | |
1298 | ||
1299 | function Serializer.DecodeColor3(data, index) | |
1300 | local components, size = Serializer.DecodeFloatArray(3, {0, 0.5, 1}, data, index) | |
1301 | return Color3.new(unpack(components)), size | |
1302 | end | |
1303 | function Serializer.DecodeFloat32(b0, b1, b2, b3) | |
1304 | local b2_low = b2 % 128 | |
1305 | local mantissa = b0 + (b1 + b2_low * 256) * 256 | |
1306 | local exponent = (b2 - b2_low) / 128 + b3 % 128 * 2 | |
1307 | local number | |
1308 | if mantissa == 0 then | |
1309 | if exponent == 0 then | |
1310 | number = 0 | |
1311 | elseif exponent == 0xFF then | |
1312 | number = math.huge | |
1313 | else | |
1314 | number = 2 ^ (exponent - 127) | |
1315 | end | |
1316 | elseif exponent == 255 then | |
1317 | number = Serializer.NAN | |
1318 | else | |
1319 | number = (1 + mantissa / 8388608) * 2 ^ (exponent - 127) | |
1320 | end | |
1321 | if b3 >= 128 then | |
1322 | return -number | |
1323 | else | |
1324 | return number | |
1325 | end | |
1326 | end | |
1327 | function Serializer.EncodeColor3(color3) | |
1328 | return Serializer.EncodeFloatArray({color3.r, color3.g, color3.b}, {0, 0.5, 1}) | |
1329 | end | |
1330 | function Serializer.EncodeFloat32(number) | |
1331 | if number == 0 then | |
1332 | if 1 / number > 0 then | |
1333 | return "\0\0\0\0" | |
1334 | else | |
1335 | return "\0\0\0\128" | |
1336 | end | |
1337 | elseif number ~= number then | |
1338 | if string.sub(tostring(number), 1, 1) == "-" then | |
1339 | return "\255\255\255\255" | |
1340 | else | |
1341 | return "\255\255\255\127" | |
1342 | end | |
1343 | elseif number == math.huge then | |
1344 | return "\0\0\128\127" | |
1345 | elseif number == -math.huge then | |
1346 | return "\0\0\128\255" | |
1347 | else | |
1348 | local b3 = 0 | |
1349 | if number < 0 then | |
1350 | number = -number | |
1351 | b3 = 128 | |
1352 | end | |
1353 | local mantissa, exponent = math.frexp(number) | |
1354 | exponent = exponent + 126 | |
1355 | if exponent < 0 then | |
1356 | return "\0\0\0" .. string.char(b3) | |
1357 | elseif exponent >= 255 then | |
1358 | return "\0\0\128" .. string.char(b3 + 0x7F) | |
1359 | else | |
1360 | local fraction = mantissa * 16777216 - 8388608 + 0.5 | |
1361 | fraction = fraction - fraction % 1 | |
1362 | local exponent_low = exponent % 2 | |
1363 | local b0 = fraction % 256 | |
1364 | local b1 = fraction % 65536 | |
1365 | local b2 = (fraction - b1) / 65536 + exponent_low * 128 | |
1366 | b1 = (b1 - b0) / 256 | |
1367 | b3 = b3 + (exponent - exponent_low) / 2 | |
1368 | return string.char(b0, b1, b2, b3) | |
1369 | end | |
1370 | end | |
1371 | end | |
1372 | ||
1373 | LuaEnum = {}; | |
1374 | ||
1375 | LuaEnum.enum_metatable = { | |
1376 | __call = function(self, value) | |
1377 | local valueType = type(value) | |
1378 | if valueType == "table" and getmetatable(value) == LuaEnum.enum_item_metatable then | |
1379 | return value | |
1380 | else | |
1381 | return self[value] | |
1382 | end | |
1383 | end, | |
1384 | __index = function(self, key) | |
1385 | local enumItem = self.ItemsByName[key] or self.ItemsByValue[key] | |
1386 | if enumItem == nil then | |
1387 | local default = self.Default | |
1388 | if default then | |
1389 | Logger.printf("Warning", "%s is not a valid EnumItem, returning default (%s)", Utility.ToString(key), tostring(default)) | |
1390 | enumItem = default | |
1391 | else | |
1392 | Logger.errorf(2, "%s is not a valid EnumItem", Utility.ToString(key)) | |
1393 | end | |
1394 | end | |
1395 | return enumItem | |
1396 | end, | |
1397 | __tostring = function(self) | |
1398 | return self.Name | |
1399 | end | |
1400 | } | |
1401 | LuaEnum.enum_item_metatable = { | |
1402 | __tostring = function(self) | |
1403 | return self.Enum.Name .. "." .. self.Name | |
1404 | end | |
1405 | } | |
1406 | LuaEnum.init_metatable = { | |
1407 | __call = function(self, items) | |
1408 | local enumItemsByName = {} | |
1409 | local enumItemsByValue = {} | |
1410 | local enum = { | |
1411 | ItemsByName = enumItemsByName, | |
1412 | ItemsByValue = enumItemsByValue, | |
1413 | Name = self[1] | |
1414 | } | |
1415 | local default = items.Default | |
1416 | if default ~= nil then | |
1417 | items.Default = nil | |
1418 | end | |
1419 | for value, name in pairs(items) do | |
1420 | local enumItem = setmetatable({ | |
1421 | Enum = enum, | |
1422 | Name = name, | |
1423 | Value = value | |
1424 | }, LuaEnum.enum_item_metatable) | |
1425 | enumItemsByName[name] = enumItem | |
1426 | enumItemsByValue[value] = enumItem | |
1427 | if name == default or value == default then | |
1428 | enum.Default = enumItem | |
1429 | end | |
1430 | end | |
1431 | return setmetatable(enum, LuaEnum.enum_metatable) | |
1432 | end | |
1433 | } | |
1434 | function LuaEnum.new(name) | |
1435 | return setmetatable({name}, LuaEnum.init_metatable) | |
1436 | end | |
1437 | ||
1438 | Logger = {}; | |
1439 | ||
1440 | Logger.entries = {0} | |
1441 | Logger.MessageType = LuaEnum.new "MessageType" { | |
1442 | "Output", | |
1443 | "Info", | |
1444 | "Warning", | |
1445 | "Severe", | |
1446 | "Error", | |
1447 | Default = "Severe" | |
1448 | } | |
1449 | Logger.MESSAGE_TYPE_SETTINGS = { | |
1450 | { -- Output | |
1451 | Font = "Arial", | |
1452 | TextColor3 = Color3.new(0, 0, 0) | |
1453 | }, | |
1454 | { -- Info | |
1455 | Font = "Arial", | |
1456 | TextColor3 = Color3.new(0, 0, 1) | |
1457 | }, | |
1458 | { -- Warning | |
1459 | Font = "ArialBold", | |
1460 | TextColor3 = Color3.new(1, 0.5, 0) | |
1461 | }, | |
1462 | { -- Severe/Error | |
1463 | Font = "ArialBold", | |
1464 | TextColor3 = Color3.new(1, 0, 0) | |
1465 | } | |
1466 | } | |
1467 | Logger.MAX_ENTRIES = 160 | |
1468 | Logger.WARNING_TRACE_ITEM_COUNT = 5 | |
1469 | Logger.rbxPrint = getfenv(RbxUtility.CreateSignal).print | |
1470 | function Logger.error(level, message) | |
1471 | message = message .. "\n" .. Logger.StackTraceToString(Logger.GenerateStackTrace(level + 1)) | |
1472 | Logger.AddEntry {Logger.MessageType.Error, message} | |
1473 | error(level + 1, message) | |
1474 | end | |
1475 | function Logger.errorf(level, messageFormat, ...) | |
1476 | Logger.error(level + 1, string.format(messageFormat, ...)) | |
1477 | end | |
1478 | function Logger.print(messageType, message, level) | |
1479 | messageType = Logger.MessageType(messageType) | |
1480 | local entry = {messageType, message} | |
1481 | Logger.rbxPrint(Logger.EntryToString(entry)) | |
1482 | Logger.AddEntry(entry) | |
1483 | if level ~= false and messageType.Value >= Logger.MessageType.Warning.Value then | |
1484 | local maxItems | |
1485 | if messageType.Value >= Logger.MessageType.Severe.Value then | |
1486 | maxItems = math.huge | |
1487 | else | |
1488 | maxItems = Logger.WARNING_TRACE_ITEM_COUNT | |
1489 | end | |
1490 | local trace = Logger.GenerateStackTrace((level or 1) + 1, math.huge, 10, maxItems + 1) | |
1491 | local traceLength = #trace | |
1492 | local stackTraceMessage | |
1493 | local suffix = "" | |
1494 | if traceLength > maxItems then | |
1495 | trace[traceLength] = nil | |
1496 | suffix = "\n..." | |
1497 | end | |
1498 | Logger.print("Info", "Stack trace:\n" .. Logger.StackTraceToString(trace) .. suffix .. "\nStack end", false) | |
1499 | end | |
1500 | end | |
1501 | function Logger.printf(messageType, messageFormat, ...) | |
1502 | Logger.print(messageType, string.format(messageFormat, ...), 2) | |
1503 | end | |
1504 | function Logger.AddEntry(entry) | |
1505 | local entries = Logger.entries | |
1506 | if entries[1] >= Logger.MAX_ENTRIES then | |
1507 | local first = entries[2] | |
1508 | local nextFirst = first[2] | |
1509 | first[1] = nil | |
1510 | first[2] = nil | |
1511 | entries[1] = entries[1] - 1 | |
1512 | entries[2] = nextFirst | |
1513 | if not nextFirst then | |
1514 | entries[3] = nil | |
1515 | end | |
1516 | end | |
1517 | local last = entries[3] | |
1518 | local node = {entry} | |
1519 | if last then | |
1520 | entries[3] = node | |
1521 | last[2] = node | |
1522 | else | |
1523 | entries[2] = node | |
1524 | entries[3] = node | |
1525 | end | |
1526 | entries[1] = entries[1] + 1 | |
1527 | end | |
1528 | function Logger.NodeIterator(list, node) | |
1529 | if node then | |
1530 | node = node[2] | |
1531 | else | |
1532 | node = list[2] | |
1533 | end | |
1534 | if node then | |
1535 | return node, node[1] | |
1536 | end | |
1537 | end | |
1538 | function Logger.EntryToString(entry) | |
1539 | local messageType, message = entry[1], tostring(entry[2]) | |
1540 | if messageType and messageType.Value >= Logger.MessageType.Info.Value then | |
1541 | return messageType.Name .. ": " .. message | |
1542 | else | |
1543 | return message | |
1544 | end | |
1545 | end | |
1546 | function Logger.GenerateStackTrace(level, maxLevel, maxTailCalls, maxTraceItems) | |
1547 | level = level + 2 | |
1548 | if maxLevel == nil then | |
1549 | maxLevel = math.huge | |
1550 | else | |
1551 | maxLevel = maxLevel + 2 | |
1552 | end | |
1553 | maxTailCalls = maxTailCalls or 10 | |
1554 | maxTraceItems = maxTraceItems or math.huge | |
1555 | local trace = {} | |
1556 | local numTailCalls = 0 | |
1557 | while level <= maxLevel and numTailCalls <= maxTailCalls and #trace < maxTraceItems do | |
1558 | local success, errorMessage = xpcall(function() error("-", level + 1) end, function(...) return ... end) | |
1559 | if errorMessage == "-" then | |
1560 | numTailCalls = numTailCalls + 1 | |
1561 | else | |
1562 | if numTailCalls > 0 then | |
1563 | local traceSize = #trace | |
1564 | if traceSize > 0 then | |
1565 | trace[#trace][3] = numTailCalls | |
1566 | end | |
1567 | numTailCalls = 0 | |
1568 | end | |
1569 | local script, line = string.match(errorMessage, "(.*):(%d+)") | |
1570 | trace[#trace + 1] = {script, tonumber(line), 0} | |
1571 | end | |
1572 | level = level + 1 | |
1573 | end | |
1574 | return trace | |
1575 | end | |
1576 | function Logger.StackTraceToString(trace) | |
1577 | local buffer = {} | |
1578 | for _, data in ipairs(trace) do | |
1579 | buffer[#buffer + 1] = string.format("Script %q, line %d", data[1], data[2]) | |
1580 | local numTailCalls = data[3] | |
1581 | if numTailCalls == 1 then | |
1582 | buffer[#buffer + 1] = "... 1 tail call" | |
1583 | elseif numTailCalls > 1 then | |
1584 | buffer[#buffer + 1] = string.format("... %d tail calls", numTailCalls) | |
1585 | end | |
1586 | end | |
1587 | return table.concat(buffer, "\n") | |
1588 | end | |
1589 | function Logger.MessageOutFunc(message, messageType) | |
1590 | if AdvancedGUI and AdvancedGUI.Print then | |
1591 | local messageTypeValue | |
1592 | if messageType == Enum.MessageType.MessageOutput then | |
1593 | local tagName, untaggedMessage = string.match(message, "(%a+): (.*)") | |
1594 | if tagName == "Info" or tagName == "Warning" or tagName == "Severe" then | |
1595 | messageTypeValue = Logger.MessageType[tagName].Value | |
1596 | message = untaggedMessage | |
1597 | else | |
1598 | messageTypeValue = Logger.MessageType.Output.Value | |
1599 | end | |
1600 | else | |
1601 | messageTypeValue = messageType.Value + 1 | |
1602 | end | |
1603 | AdvancedGUI.PrintFormat(Logger.MESSAGE_TYPE_SETTINGS[messageTypeValue], message) | |
1604 | end | |
1605 | end | |
1606 | function print(...) | |
1607 | local args = {...} | |
1608 | local buffer = {} | |
1609 | for index = 1, select("#", ...) do | |
1610 | buffer[index] = tostring(args[index]) | |
1611 | end | |
1612 | local message = table.concat(buffer, "\t") | |
1613 | Logger.print("Output", message) | |
1614 | end | |
1615 | ||
1616 | CharacterAppearance = {}; | |
1617 | ||
1618 | CharacterAppearance.defaultAppearanceId = 2 | |
1619 | CharacterAppearance.stock = {} | |
1620 | function CharacterAppearance.Create(properties) | |
1621 | local id = properties.Id | |
1622 | local bodyColors = Instance.new("BodyColors") | |
1623 | bodyColors.HeadColor = properties.HeadColor | |
1624 | bodyColors.TorsoColor = properties.TorsoColor | |
1625 | bodyColors.RightArmColor = properties.RightArmColor | |
1626 | bodyColors.LeftArmColor = properties.LeftArmColor | |
1627 | bodyColors.RightLegColor = properties.RightLegColor | |
1628 | bodyColors.LeftLegColor = properties.LeftLegColor | |
1629 | local characterObjects = {bodyColors} | |
1630 | local headObjects = {} | |
1631 | local data = { | |
1632 | characterObjects = characterObjects, | |
1633 | headObjects = headObjects, | |
1634 | tshirt = properties.TShirt | |
1635 | } | |
1636 | for _, assetId in ipairs(properties.CharacterAssets) do | |
1637 | TaskScheduler.Start(CharacterAppearance.LoadAsset, characterObjects, assetId) | |
1638 | end | |
1639 | for _, assetId in ipairs(properties.HeadAssets) do | |
1640 | TaskScheduler.Start(CharacterAppearance.LoadAsset, headObjects, assetId) | |
1641 | end | |
1642 | CharacterAppearance.stock[id] = data | |
1643 | end | |
1644 | function CharacterAppearance.GetDefaultAppearance() | |
1645 | return CharacterAppearance.stock[CharacterAppearance.defaultAppearanceId] | |
1646 | end | |
1647 | function CharacterAppearance.LoadAsset(objects, assetId) | |
1648 | local asset = InsertService:LoadAsset(assetId) | |
1649 | for _, child in ipairs(asset:GetChildren()) do | |
1650 | child.Archivable = true | |
1651 | table.insert(objects, child:Clone()) | |
1652 | end | |
1653 | end | |
1654 | CharacterAppearance.Create { | |
1655 | Id = 1, | |
1656 | HeadColor = BrickColor.new("Institutional white"), | |
1657 | TorsoColor = BrickColor.new("Institutional white"), | |
1658 | RightArmColor = BrickColor.new("Institutional white"), | |
1659 | LeftArmColor = BrickColor.new("Institutional white"), | |
1660 | RightLegColor = BrickColor.new("Institutional white"), | |
1661 | LeftLegColor = BrickColor.new("Institutional white"), | |
1662 | CharacterAssets = { | |
1663 | 90825058, 90825211, | |
1664 | 27112056, 27112052, | |
1665 | 27112039, 27112025, | |
1666 | 27112068, 38322996 | |
1667 | }, | |
1668 | HeadAssets = { | |
1669 | 20722130, | |
1670 | 8330576 | |
1671 | } | |
1672 | } | |
1673 | CharacterAppearance.Create { | |
1674 | Id = 2, | |
1675 | HeadColor = BrickColor.new("Institutional white"), | |
1676 | TorsoColor = BrickColor.new("Institutional white"), | |
1677 | RightArmColor = BrickColor.new("Institutional white"), | |
1678 | LeftArmColor = BrickColor.new("Institutional white"), | |
1679 | RightLegColor = BrickColor.new("Institutional white"), | |
1680 | LeftLegColor = BrickColor.new("Institutional white"), | |
1681 | CharacterAssets = { | |
1682 | 90825058, 90825211, | |
1683 | 11748356, 1029025, | |
1684 | 1235488, 27112056, | |
1685 | 27112052, 27112039, | |
1686 | 27112025, 27112068 | |
1687 | }, | |
1688 | HeadAssets = { | |
1689 | 20722130 | |
1690 | } | |
1691 | } | |
1692 | CharacterAppearance.Create { | |
1693 | Id = 3, | |
1694 | HeadColor = BrickColor.new("Pastel brown"), | |
1695 | TorsoColor = BrickColor.new("Pastel brown"), | |
1696 | RightArmColor = BrickColor.new("Pastel brown"), | |
1697 | LeftArmColor = BrickColor.new("Pastel brown"), | |
1698 | RightLegColor = BrickColor.new("White"), | |
1699 | LeftLegColor = BrickColor.new("White"), | |
1700 | CharacterAssets = { | |
1701 | 134289125, 48474356, | |
1702 | 100339040, 46302558, | |
1703 | 153955895 | |
1704 | }, | |
1705 | HeadAssets = {}, | |
1706 | TShirt = "rbxassetid://148856353" | |
1707 | } | |
1708 | CharacterAppearance.Create { | |
1709 | Id = 4, | |
1710 | HeadColor = BrickColor.new("Pastel brown"), | |
1711 | TorsoColor = BrickColor.new("Pastel brown"), | |
1712 | RightArmColor = BrickColor.new("Pastel brown"), | |
1713 | LeftArmColor = BrickColor.new("Pastel brown"), | |
1714 | RightLegColor = BrickColor.new("White"), | |
1715 | LeftLegColor = BrickColor.new("White"), | |
1716 | CharacterAssets = { | |
1717 | 129458426, 96678344, 184489190 | |
1718 | }, | |
1719 | HeadAssets = {}, | |
1720 | TShirt = "rbxassetid://160146697" | |
1721 | } | |
1722 | ||
1723 | GraphicalEffects = {}; | |
1724 | ||
1725 | local MESH_IDS = {"rbxassetid://15310891"} | |
1726 | local SOUND_IDS = {"rbxassetid://2248511", "rbxassetid://1369158"} | |
1727 | local TEXTURE_IDS = {"rbxassetid://36527089", "rbxassetid://122610943", "rbxassetid://126561317", "rbxassetid://127033719"} | |
1728 | local preloadConnections = {} | |
1729 | local reloadingPreloads = false | |
1730 | function GraphicalEffects.InitPreloads() | |
1731 | local preload_part = Instance.new("Part") | |
1732 | GraphicalEffects.preload_part = preload_part | |
1733 | preload_part.Anchored = true | |
1734 | preload_part.Archivable = false | |
1735 | preload_part.BottomSurface = "Smooth" | |
1736 | preload_part.CanCollide = false | |
1737 | preload_part.CFrame = CFrame.new(math.huge, math.huge, math.huge) | |
1738 | preload_part.FormFactor = "Custom" | |
1739 | preload_part.Locked = true | |
1740 | preload_part.Name = "Asset Preloader" | |
1741 | preload_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
1742 | preload_part.TopSurface = "Smooth" | |
1743 | preload_part.Transparency = 1 | |
1744 | preloadConnections[preload_part] = preload_part.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged) | |
1745 | for _, mesh_id in ipairs(MESH_IDS) do | |
1746 | local mesh = Instance.new("SpecialMesh") | |
1747 | mesh.MeshType = "FileMesh" | |
1748 | mesh.MeshId = mesh_id | |
1749 | preloadConnections[mesh] = mesh.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged) | |
1750 | mesh.Parent = preload_part | |
1751 | end | |
1752 | for _, sound_id in ipairs(SOUND_IDS) do | |
1753 | local sound = Instance.new("Sound") | |
1754 | sound.SoundId = sound_id | |
1755 | sound.Volume = 0 | |
1756 | preloadConnections[sound] = sound.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged) | |
1757 | sound.Parent = preload_part | |
1758 | end | |
1759 | for _, texture_id in ipairs(TEXTURE_IDS) do | |
1760 | local decal = Instance.new("Decal") | |
1761 | decal.Texture = texture_id | |
1762 | preloadConnections[decal] = decal.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged) | |
1763 | decal.Parent = preload_part | |
1764 | end | |
1765 | preload_part.Parent = Workspace | |
1766 | end | |
1767 | function GraphicalEffects.PreloadsAncestryChanged(child, parent) | |
1768 | if not reloadingPreloads and parent ~= GraphicalEffects.preload_part and parent ~= Workspace then | |
1769 | reloadingPreloads = true | |
1770 | for _, connection in pairs(preloadConnections) do | |
1771 | connection:disconnect() | |
1772 | preloadConnections[_] = nil | |
1773 | end | |
1774 | wait(1) | |
1775 | reloadingPreloads = false | |
1776 | GraphicalEffects.InitPreloads() | |
1777 | end | |
1778 | end | |
1779 | GraphicalEffects.InitPreloads() | |
1780 | -- Hyper beam | |
1781 | function GraphicalEffects.FireSpaceHyperBeam(target, power, duration, radius, height, deviation) | |
1782 | local stepTime, gameTime = 1 / 30, TaskScheduler.GetCurrentTime() | |
1783 | local frames = duration * 30 | |
1784 | local beamColorOffset = 0.75 * tick() -- math.random() | |
1785 | local blastPressure = power * 62500 + 250000 | |
1786 | local beamPart = Instance.new("Part") | |
1787 | local beamMesh = Instance.new("SpecialMesh", beamPart) | |
1788 | local explosion = Instance.new("Explosion") | |
1789 | local sound = Instance.new("Sound", beamPart) | |
1790 | beamPart.Anchored = true | |
1791 | beamPart.CanCollide = false | |
1792 | beamPart.CFrame = CFrame.new(target, target + Vector3.new(deviation * (math.random() - 0.5), deviation * (math.random() - 0.5), height)) | |
1793 | beamPart.FormFactor = "Custom" | |
1794 | beamPart.Locked = true | |
1795 | beamPart.Size = Vector3.new(0.2, 0.2, 0.2) | |
1796 | beamMesh.MeshId = "rbxassetid://15310891" | |
1797 | beamMesh.MeshType = "FileMesh" | |
1798 | beamMesh.TextureId = "rbxassetid://36527089" | |
1799 | local beamGlowPart1 = beamPart:Clone() | |
1800 | local beamGlowMesh1 = beamMesh:Clone() | |
1801 | local beamGlowPart2 = beamPart:Clone() | |
1802 | local beamGlowMesh2 = beamMesh:Clone() | |
1803 | local beamLight = Instance.new("PointLight", beamPart) | |
1804 | beamLight.Range = power * 2 | |
1805 | beamLight.Shadows = true | |
1806 | explosion.BlastPressure = blastPressure | |
1807 | explosion.BlastRadius = power | |
1808 | explosion.Position = target | |
1809 | sound.SoundId = "rbxassetid://2248511" | |
1810 | sound.Volume = 1 | |
1811 | local explosionHitConnection = explosion.Hit:connect(function(part, distance) | |
1812 | if not part.Anchored and part:GetMass() < power * power then | |
1813 | pcall(part.BreakJoints, part) | |
1814 | part.Color = Color3.new(Utility.GetRainbowRGB(1.5 * gameTime + beamColorOffset)) | |
1815 | end | |
1816 | end) | |
1817 | beamPart.Transparency = 0.5 | |
1818 | beamPart.Archivable = false | |
1819 | beamGlowPart1.Transparency = 0.75 | |
1820 | beamGlowPart2.Transparency = 0.75 | |
1821 | beamGlowMesh1.Parent = beamGlowPart1 | |
1822 | beamGlowPart1.Parent = beamPart | |
1823 | beamGlowMesh2.Parent = beamGlowPart2 | |
1824 | beamGlowPart2.Parent = beamPart | |
1825 | beamPart.Parent = workspace | |
1826 | explosion.Parent = workspace | |
1827 | for frame = 1, frames do | |
1828 | local progress = frame / frames | |
1829 | local alpha = 1 - math.sin(0.5 * math.pi * progress) | |
1830 | local scale = 0.4 * alpha | |
1831 | local glowScale1 = alpha * (0.5 + 0.5 * math.sin(math.tau * (8 * gameTime + beamColorOffset))) | |
1832 | local glowScale2 = alpha * (0.5 + 0.5 * math.cos(math.tau * (8 * gameTime + beamColorOffset))) | |
1833 | local vertexColor = Vector3.new(Utility.GetRainbowRGB(1.5 * gameTime + beamColorOffset)) | |
1834 | beamLight.Brightness = 1 - progress | |
1835 | beamLight.Color = Color3.new(vertexColor.x, vertexColor.y, vertexColor.z) | |
1836 | beamMesh.Scale = Vector3.new(radius * scale, 9000, radius * scale) | |
1837 | beamMesh.VertexColor = vertexColor | |
1838 | beamGlowMesh1.Scale = Vector3.new(1.2 * radius * glowScale1, 9000, 1.2 * radius * glowScale1) | |
1839 | beamGlowMesh1.VertexColor = vertexColor | |
1840 | beamGlowMesh2.Scale = Vector3.new(1.2 * radius * glowScale2, 9000, 1.2 * radius * glowScale2) | |
1841 | beamGlowMesh2.VertexColor = vertexColor | |
1842 | RunService.Stepped:wait() | |
1843 | gameTime = TaskScheduler.GetCurrentTime() | |
1844 | if frame <= 2 then | |
1845 | local explosion = Instance.new("Explosion") | |
1846 | explosion.BlastPressure = (1 - progress) * blastPressure | |
1847 | explosion.BlastRadius = (1 - progress) * power | |
1848 | explosion.Position = target | |
1849 | explosion.Parent = Workspace | |
1850 | if frame == 2 then | |
1851 | sound:Play() | |
1852 | end | |
1853 | end | |
1854 | end | |
1855 | pcall(beamPart.Destroy, beamPart) | |
1856 | explosionHitConnection:disconnect() | |
1857 | end | |
1858 | function GraphicalEffects.SpaceHyperBeam(target, power, duration, radius, height, deviation) | |
1859 | TaskScheduler.Start(GraphicalEffects.FireSpaceHyperBeam, target, power or 12, duration or 1.5, radius or 6, height or 600, deviation or 20) | |
1860 | end | |
1861 | ||
1862 | function GraphicalEffects.CrystalRing(data) | |
1863 | data = data or {} | |
1864 | local crystal_count = data.crystal_count or 10 | |
1865 | local crystal_color = data.crystal_color or BrickColor.new("Bright red") | |
1866 | local crystal_scale = data.crystal_scale or Vector3.new(2 / 3, 2, 2 / 3) | |
1867 | local fade_out_color = data.fade_out_color or BrickColor.new("Really black") | |
1868 | local radius = radius or 1.25 * crystal_count / math.pi | |
1869 | local spawn_duration = data.spawn_duration or 0.065 | |
1870 | local full_spawn_duration = spawn_duration * crystal_count | |
1871 | local float_duration = data.float_duration or 5 | |
1872 | local wave_amplitude = data.wave_amplitude or 0.5 | |
1873 | local wave_period = data.wave_period or 1 | |
1874 | local appear_duration = data.appear_duration or 0.1 | |
1875 | local disappear_duration = data.disappear_duration or 0.5 | |
1876 | local base_part = data.base_part | |
1877 | local offset_cframe | |
1878 | if data.position then | |
1879 | offset_cframe = CFrame.new(data.position) | |
1880 | if base_part then | |
1881 | offset_cframe = base_part.CFrame:toObjectSpace(offset_cframe) | |
1882 | end | |
1883 | else | |
1884 | offset_cframe = CFrame.new() | |
1885 | end | |
1886 | local crystal_template = Instance.new("Part") | |
1887 | crystal_template.Anchored = true | |
1888 | crystal_template.Locked = true | |
1889 | crystal_template.CanCollide = false | |
1890 | crystal_template.BottomSurface = "Smooth" | |
1891 | crystal_template.TopSurface = "Smooth" | |
1892 | crystal_template.BrickColor = crystal_color | |
1893 | crystal_template.FormFactor = "Symmetric" | |
1894 | crystal_template.Size = Vector3.new(1, 1, 1) | |
1895 | local crystal_light = Instance.new("PointLight", crystal_template) | |
1896 | crystal_light.Brightness = 0.1 / crystal_count | |
1897 | crystal_light.Color = crystal_color.Color | |
1898 | crystal_light.Name = "Light" | |
1899 | crystal_light.Range = radius | |
1900 | crystal_light.Shadows = true | |
1901 | local crystal_mesh = Instance.new("SpecialMesh", crystal_template) | |
1902 | crystal_mesh.MeshId = "rbxassetid://9756362" | |
1903 | crystal_mesh.MeshType = "FileMesh" | |
1904 | crystal_mesh.Name = "Mesh" | |
1905 | crystal_mesh.Scale = crystal_scale | |
1906 | local crystal_model = Instance.new("Model") | |
1907 | crystal_model.Archivable = false | |
1908 | crystal_model.Name = "Crystal Model" | |
1909 | crystal_model.Parent = Workspace | |
1910 | local crystals = {} | |
1911 | local lights = {} | |
1912 | local meshes = {} | |
1913 | for index = 1, crystal_count do | |
1914 | local crystal = crystal_template:Clone() | |
1915 | crystal.Parent = crystal_model | |
1916 | crystals[index] = crystal | |
1917 | lights[index] = crystal.Light | |
1918 | meshes[index] = crystal.Mesh | |
1919 | end | |
1920 | local start_time = tick() | |
1921 | repeat | |
1922 | local base_cframe = offset_cframe | |
1923 | if base_part then | |
1924 | base_cframe = base_part.CFrame * base_cframe | |
1925 | end | |
1926 | local elapsed_time = tick() - start_time | |
1927 | for index, crystal in ipairs(crystals) do | |
1928 | local crystal_time = elapsed_time - index * spawn_duration | |
1929 | local disappear_time = crystal_time - float_duration | |
1930 | local offset | |
1931 | if crystal_time < 0 then | |
1932 | offset = 0 | |
1933 | elseif crystal_time < appear_duration then | |
1934 | offset = radius * crystal_time / appear_duration | |
1935 | else | |
1936 | offset = radius | |
1937 | end | |
1938 | local wave_offset | |
1939 | if disappear_time >= 0 then | |
1940 | local disappear_progress = disappear_time / disappear_duration | |
1941 | if disappear_progress > 1 then | |
1942 | if crystal.Parent then | |
1943 | crystal:Destroy() | |
1944 | end | |
1945 | else | |
1946 | local inverse_progress = 1 - disappear_progress | |
1947 | local light = lights[index] | |
1948 | local mesh = meshes[index] | |
1949 | crystal.BrickColor = fade_out_color | |
1950 | light.Brightness = 2 * inverse_progress | |
1951 | light.Range = 2 * radius | |
1952 | mesh.Scale = crystal_scale * inverse_progress | |
1953 | end | |
1954 | wave_offset = 0 | |
1955 | else | |
1956 | wave_offset = wave_amplitude * math.sin(math.tau * (elapsed_time - index / crystal_count * 3) / wave_period) | |
1957 | end | |
1958 | local rotation_angle = (tick() * 0.5 + (index - 1) / crystal_count) % 1 * math.tau | |
1959 | crystal.CFrame = base_cframe * CFrame.Angles(0, rotation_angle, 0) * CFrame.new(0, wave_offset, -offset) | |
1960 | end | |
1961 | RunService.Stepped:wait() | |
1962 | until elapsed_time >= float_duration + full_spawn_duration + disappear_duration | |
1963 | if crystal_model.Parent then | |
1964 | crystal_model:Destroy() | |
1965 | end | |
1966 | end | |
1967 | ||
1968 | GraphicalEffects.magicCircleData = {} | |
1969 | GraphicalEffects.MAGIC_CIRCLE_DEFAULT_OFFSET = 6.25 | |
1970 | function GraphicalEffects.AnimateMagicCircle(data) | |
1971 | local frame, direction, magic_circle_model, magic_circle_part, magic_circle_light, magic_circle_decal_back, magic_circle_decal_front, duration, | |
1972 | ||
1973 | stay, magic_circle_adornee_func, magic_circle_offset = unpack(data) | |
1974 | frame = frame + 1 | |
1975 | data[1] = frame | |
1976 | local transparency = (frame / duration) ^ stay | |
1977 | local opacity = 1 - transparency | |
1978 | if frame == duration then | |
1979 | pcall(Game.Destroy, magic_circle_model) | |
1980 | GraphicalEffects.magicCircleData[data] = nil | |
1981 | else | |
1982 | if magic_circle_model.Parent ~= Workspace then | |
1983 | pcall(Utility.SetProperty, magic_circle_model, "Parent", Workspace) | |
1984 | end | |
1985 | local magic_circle_adornee = magic_circle_adornee_func() | |
1986 | magic_circle_position = magic_circle_adornee.Position + direction * magic_circle_offset | |
1987 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, math.tau * frame / | |
1988 | ||
1989 | 25) | |
1990 | magic_circle_part.CFrame = magic_circle_cframe | |
1991 | magic_circle_light.Brightness = opacity | |
1992 | magic_circle_decal_back.Transparency = transparency | |
1993 | magic_circle_decal_front.Transparency = transparency | |
1994 | end | |
1995 | end | |
1996 | function GraphicalEffects.CreateMagicCircle(target, magic_circle_scale, magic_circle_image, light_color, duration, stay, magic_circle_adornee_func, | |
1997 | ||
1998 | magic_circle_offset) | |
1999 | local magic_circle_adornee = magic_circle_adornee_func() | |
2000 | if magic_circle_adornee then | |
2001 | local origin = magic_circle_adornee.Position | |
2002 | local direction = (target - origin).unit | |
2003 | local magic_circle_position = origin + direction * magic_circle_offset | |
2004 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) | |
2005 | local magic_circle_model = Instance.new("Model") | |
2006 | local magic_circle_part = Instance.new("Part", magic_circle_model) | |
2007 | local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part) | |
2008 | local magic_circle_light = Instance.new("PointLight", magic_circle_part) | |
2009 | local magic_circle_decal_back = Instance.new("Decal", magic_circle_part) | |
2010 | local magic_circle_decal_front = Instance.new("Decal", magic_circle_part) | |
2011 | magic_circle_model.Archivable = false | |
2012 | magic_circle_part.Anchored = true | |
2013 | magic_circle_part.BottomSurface = "Smooth" | |
2014 | magic_circle_part.CanCollide = false | |
2015 | magic_circle_part.CFrame = magic_circle_cframe | |
2016 | magic_circle_part.FormFactor = "Custom" | |
2017 | magic_circle_part.Locked = true | |
2018 | magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
2019 | magic_circle_part.TopSurface = "Smooth" | |
2020 | magic_circle_part.Transparency = 1 | |
2021 | magic_circle_mesh.Scale = Vector3.new(60, 60, 0) * magic_circle_scale | |
2022 | magic_circle_light.Color = light_color | |
2023 | magic_circle_light.Range = 16 * magic_circle_scale | |
2024 | magic_circle_light.Shadows = true | |
2025 | magic_circle_decal_back.Face = "Back" | |
2026 | magic_circle_decal_back.Texture = magic_circle_image | |
2027 | magic_circle_decal_front.Face = "Front" | |
2028 | magic_circle_decal_front.Texture = magic_circle_image | |
2029 | magic_circle_model.Parent = Workspace | |
2030 | local data = {0, direction, magic_circle_model, magic_circle_part, magic_circle_light, magic_circle_decal_back, magic_circle_decal_front, | |
2031 | ||
2032 | duration, stay, magic_circle_adornee_func, magic_circle_offset} | |
2033 | GraphicalEffects.magicCircleData[data] = true | |
2034 | return data | |
2035 | end | |
2036 | end | |
2037 | ||
2038 | GraphicalEffects.missileData = {} | |
2039 | GraphicalEffects.missileParts = {} | |
2040 | function GraphicalEffects.AnimateMissile(data) | |
2041 | local frame, missilePart, targetPart, timeCreated, direction, touchedConnection, explodeRequested, bodyGyro, swooshSound, magicCircleData, lifeTime, | |
2042 | ||
2043 | pointOnPart, flipped = unpack(data) | |
2044 | frame = frame + 1 | |
2045 | data[1] = frame | |
2046 | if flipped then | |
2047 | direction = -direction | |
2048 | end | |
2049 | if frame <= 10 then | |
2050 | if frame == 2 then | |
2051 | swooshSound:Play() | |
2052 | end | |
2053 | missilePart.Anchored = true | |
2054 | local progress = frame / 10 | |
2055 | missilePart.Size = Vector3.new(1, 1, progress * 4) | |
2056 | local magicCirclePart = magicCircleData[4] | |
2057 | local magicCirclePosition = magicCirclePart.Position | |
2058 | local missileOffset = 2 * progress * direction | |
2059 | local missilePosition = magicCirclePosition + missileOffset | |
2060 | missilePart.CFrame = CFrame.new(missilePosition, missilePosition + direction) | |
2061 | --missilePart.Transparency = 0.5 * (1 - progress) | |
2062 | if frame == 10 then | |
2063 | touchedConnection = missilePart.Touched:connect(function(hit) | |
2064 | if hit.CanCollide and hit.Parent and not GraphicalEffects.missileParts[hit] then | |
2065 | touchedConnection:disconnect() | |
2066 | data[7] = true | |
2067 | end | |
2068 | end) | |
2069 | data[6] = touchedConnection | |
2070 | end | |
2071 | else | |
2072 | missilePart.Anchored = false | |
2073 | local missilePosition = missilePart.Position | |
2074 | local targetPosition = targetPart.CFrame * pointOnPart | |
2075 | local distanceVector = targetPosition - missilePosition | |
2076 | local elapsedTime = time() - timeCreated | |
2077 | local targetParent = targetPart.Parent | |
2078 | if explodeRequested or (targetParent and distanceVector.magnitude < 10) or elapsedTime > lifeTime then | |
2079 | GraphicalEffects.missileData[data] = nil | |
2080 | GraphicalEffects.missileParts[missilePart] = nil | |
2081 | touchedConnection:disconnect() | |
2082 | if missilePart.Parent then | |
2083 | missilePart:Destroy() | |
2084 | local explosion = Instance.new("Explosion") | |
2085 | explosion.BlastRadius = 12.5 | |
2086 | explosion.Position = missilePosition | |
2087 | local explosionHitConnection = explosion.Hit:connect(function(hit, distance) | |
2088 | local missileData = GraphicalEffects.missileParts[hit] | |
2089 | if missileData and distance < 3 then | |
2090 | missileData[7] = true | |
2091 | else | |
2092 | pcall(hit.BreakJoints, hit) | |
2093 | end | |
2094 | end) | |
2095 | explosion.Parent = Workspace | |
2096 | TaskScheduler.Schedule(1, explosionHitConnection.disconnect, explosionHitConnection) | |
2097 | end | |
2098 | else | |
2099 | local targetInWorkspace = targetPart:IsDescendantOf(Workspace) | |
2100 | if targetInWorkspace then | |
2101 | direction = distanceVector.unit | |
2102 | data[5] = direction | |
2103 | end | |
2104 | local speed = 14 + elapsedTime * 10 | |
2105 | local gyroD | |
2106 | if elapsedTime < 42.5 and targetInWorkspace then | |
2107 | gyroD = 1000 - elapsedTime * 15 | |
2108 | else | |
2109 | gyroD = 100 | |
2110 | bodyGyro.maxTorque = Vector3.new(0, 0, 0) | |
2111 | if elapsedTime + 7.5 < lifeTime then | |
2112 | data[11] = elapsedTime + 7.5 | |
2113 | end | |
2114 | end | |
2115 | bodyGyro.D = gyroD | |
2116 | bodyGyro.cframe = CFrame.new(Vector3.new(), direction) | |
2117 | missilePart.Velocity = missilePart.CFrame.lookVector * speed | |
2118 | end | |
2119 | end | |
2120 | end | |
2121 | function GraphicalEffects.ShootMissile(targetPart, pointOnPart, direction, magic_circle_adornee_func, magic_circle_offset, flipped) | |
2122 | if not magic_circle_offset then | |
2123 | magic_circle_offset = GraphicalEffects.MAGIC_CIRCLE_DEFAULT_OFFSET | |
2124 | end | |
2125 | local targetPosition = targetPart.Position | |
2126 | local headPosition = chatAdornee.Position | |
2127 | local origin = CFrame.new(headPosition, headPosition + direction) + direction * magic_circle_offset | |
2128 | local missilePart = Instance.new("Part") | |
2129 | local antiGravityForce = Instance.new("BodyForce", missilePart) | |
2130 | local bodyGyro = Instance.new("BodyGyro", missilePart) | |
2131 | local explosionSound = Instance.new("Sound", missilePart) | |
2132 | local swooshSound = Instance.new("Sound", missilePart) | |
2133 | antiGravityForce.force = Vector3.new(0, 196.2 * 4, 0) | |
2134 | bodyGyro.D = 1000 | |
2135 | bodyGyro.maxTorque = Vector3.new(1, 1, 1) | |
2136 | explosionSound.PlayOnRemove = true | |
2137 | explosionSound.SoundId = "rbxasset://sounds/collide.wav" | |
2138 | explosionSound.Volume = 1 | |
2139 | missilePart.Anchored = true | |
2140 | missilePart.BackSurface = "Studs" | |
2141 | missilePart.BottomSurface = "Studs" | |
2142 | missilePart.BrickColor = BrickColor.Red() | |
2143 | missilePart.CFrame = origin | |
2144 | missilePart.FormFactor = "Custom" | |
2145 | missilePart.FrontSurface = "Studs" | |
2146 | missilePart.LeftSurface = "Studs" | |
2147 | missilePart.Locked = true | |
2148 | missilePart.RightSurface = "Studs" | |
2149 | missilePart.Size = Vector3.new(1, 1, 0.2) | |
2150 | missilePart.TopSurface = "Studs" | |
2151 | --missilePart.Transparency = 0.5 | |
2152 | swooshSound.Looped = true | |
2153 | swooshSound.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav" | |
2154 | swooshSound.Volume = 0.7 | |
2155 | local magicCircleData = GraphicalEffects.CreateMagicCircle(headPosition + direction * 1000, 0.875, "rbxassetid://127033719", Color3.new(1, 1, 1), | |
2156 | ||
2157 | 40, 4, magic_circle_adornee_func or function() return chatAdornee end, magic_circle_offset) | |
2158 | local data = {0, missilePart, targetPart, time(), direction, false, false, bodyGyro, swooshSound, magicCircleData, 50, pointOnPart, flipped} | |
2159 | missilePart.Parent = Workspace | |
2160 | GraphicalEffects.missileData[data] = true | |
2161 | GraphicalEffects.missileParts[missilePart] = data | |
2162 | end | |
2163 | ||
2164 | function GraphicalEffects.CubicInterpolate(y0, y1, y2, y3, mu) | |
2165 | local a0, a1, a2, a3, mu2 | |
2166 | mu2 = mu * mu | |
2167 | a0 = y3 - y2 - y0 + y1 | |
2168 | a1 = y0 - y1 - a0 | |
2169 | a2 = y2 - y0 | |
2170 | a3 = y1 | |
2171 | return a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3 | |
2172 | end | |
2173 | function GraphicalEffects.JointCrap(model, cycletime) | |
2174 | if model then | |
2175 | local cycletime = cycletime or (0.75 * (1 + math.random() * 4)) | |
2176 | local offsetradius = 0.75 | |
2177 | local rotationoffset = math.pi | |
2178 | local joints = {} | |
2179 | local stack = model:GetChildren() | |
2180 | while #stack ~= 0 do | |
2181 | local object = stack[#stack] | |
2182 | table.remove(stack) | |
2183 | for index, child in ipairs(object:GetChildren()) do | |
2184 | table.insert(stack, child) | |
2185 | end | |
2186 | if object:IsA("JointInstance") then | |
2187 | table.insert(joints, object) | |
2188 | end | |
2189 | end | |
2190 | local rot0 = {} | |
2191 | local rot1 = {} | |
2192 | local rot2 = {} | |
2193 | local rot3 = {} | |
2194 | local rot4 = {} | |
2195 | for index, joint in ipairs(joints) do | |
2196 | local pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius | |
2197 | local rot = Vector3.new(math.random(), math.random(), math.random()) * rotationoffset | |
2198 | rot0[index] = {joint.C0, joint.C1} | |
2199 | rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau)) | |
2200 | rot2[index] = {pos, rot} | |
2201 | pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius | |
2202 | rot = rot + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset | |
2203 | rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau)) | |
2204 | rot3[index] = {pos, rot} | |
2205 | pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius | |
2206 | rot = rot + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset | |
2207 | rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau)) | |
2208 | rot4[index] = {pos, rot} | |
2209 | end | |
2210 | while model.Parent do | |
2211 | for i, j in ipairs(joints) do | |
2212 | local pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius | |
2213 | local rot = rot4[i][2] + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset | |
2214 | rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau)) | |
2215 | rot1[i], rot2[i], rot3[i], rot4[i] = rot2[i], rot3[i], rot4[i], {pos, rot} | |
2216 | end | |
2217 | local start = tick() | |
2218 | while true do | |
2219 | local ctime = tick() | |
2220 | local elapsed = ctime - start | |
2221 | if elapsed > cycletime then | |
2222 | break | |
2223 | end | |
2224 | local progress = elapsed / cycletime | |
2225 | for index, joint in ipairs(joints) do | |
2226 | local v0, v1, v2, v3, v4 = rot0[index], rot1[index], rot2[index], rot3[index], rot4[index] | |
2227 | local p1, p2, p3, p4, r1, r2, r3, r4 = v1[1], v2[1], v3[1], v4[1], v1[2], v2[2], v3[2], v4[2] | |
2228 | local px = GraphicalEffects.CubicInterpolate(p1.x, p2.x, p3.x, p4.x, progress) | |
2229 | local py = GraphicalEffects.CubicInterpolate(p1.y, p2.y, p3.y, p4.y, progress) | |
2230 | local pz = GraphicalEffects.CubicInterpolate(p1.z, p2.z, p3.z, p4.z, progress) | |
2231 | local rx = GraphicalEffects.CubicInterpolate(r1.x, r2.x, r3.x, r4.x, progress) | |
2232 | local ry = GraphicalEffects.CubicInterpolate(r1.y, r2.y, r3.y, r4.y, progress) | |
2233 | local rz = GraphicalEffects.CubicInterpolate(r1.z, r2.z, r3.z, r4.z, progress) | |
2234 | local cframe = CFrame.new(px, py, pz) * CFrame.Angles(rx, ry, rz) | |
2235 | joint.C0 = v0[1] * cframe | |
2236 | joint.C1 = v0[2] * cframe:inverse() | |
2237 | end | |
2238 | RunService.Stepped:wait() | |
2239 | end | |
2240 | end | |
2241 | end | |
2242 | end | |
2243 | ||
2244 | GraphicalEffects.LASER_WIDTH = 0.15 | |
2245 | GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE = 6.25 | |
2246 | GraphicalEffects.laser_data = {} | |
2247 | --GraphicalEffects.fragmentation = {} | |
2248 | function GraphicalEffects.AnimateLaserOfDeath(data) | |
2249 | local frame, directionOrientation, direction, magic_circle_model, laser_part, laser_mesh, magic_circle_part, magic_circle_light, | |
2250 | ||
2251 | magic_circle_decal_back, magic_circle_decal_front, sound, laser_scale, fragmentation_size, duration, laser_lights, laser_effects, stay, light_effects = | |
2252 | ||
2253 | unpack(data) | |
2254 | local laser_color = laser_part.Color | |
2255 | frame = frame + 1 | |
2256 | data[1] = frame | |
2257 | local transparency = (frame / duration) ^ stay | |
2258 | local opacity = 1 - transparency | |
2259 | if frame == 2 then | |
2260 | sound:Play() | |
2261 | end | |
2262 | if frame == duration then | |
2263 | pcall(Game.Destroy, magic_circle_model) | |
2264 | GraphicalEffects.laser_data[data] = nil | |
2265 | else | |
2266 | if magic_circle_model.Parent ~= Workspace then | |
2267 | pcall(Utility.SetProperty, magic_circle_model, "Parent", Workspace) | |
2268 | end | |
2269 | local laser_distance = 0 | |
2270 | local origin = chatAdornee.CFrame | |
2271 | if not light_effects then | |
2272 | direction = (origin * directionOrientation - origin.p).unit | |
2273 | end | |
2274 | local magic_circle_position = origin.p + direction * GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE | |
2275 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, math.tau * frame / | |
2276 | ||
2277 | 25) | |
2278 | local loop_scale = (laser_scale - 1) / 10 | |
2279 | for x_offset = -loop_scale, loop_scale, 2 do | |
2280 | for y_offset = -loop_scale, loop_scale, 2 do | |
2281 | local origin_position = magic_circle_cframe * Vector3.new(x_offset, y_offset, 0) | |
2282 | for index = 1, 8 do | |
2283 | local part, position | |
2284 | for ray_index = 1, 10 do | |
2285 | local ray = Ray.new(origin_position + direction * (999 * (ray_index - 1)), direction * 999) | |
2286 | part, position = Workspace:FindPartOnRay(ray, magic_circle_model) | |
2287 | if part then | |
2288 | break | |
2289 | end | |
2290 | end | |
2291 | if part then | |
2292 | laser_distance = (position - origin_position).magnitude | |
2293 | if frame % 8 == 1 and index == 1 then | |
2294 | Instance.new("Explosion", Workspace).Position = position | |
2295 | end | |
2296 | if not part:IsA("Terrain") then | |
2297 | pcall(part.BreakJoints, part) | |
2298 | local is_block = part:IsA("Part") and part.Shape == Enum.PartType.Block | |
2299 | local mass = part:GetMass() | |
2300 | local size = part.Size | |
2301 | if (is_block and ((size.X < fragmentation_size and size.Y < fragmentation_size and size.Z < | |
2302 | ||
2303 | fragmentation_size) or (not part.Anchored and mass < 750))) or (not is_block and mass < 250000) then | |
2304 | local part_transparency = math.max(part.Transparency + 0.007 * fragmentation_size, 0.5) | |
2305 | if part_transparency >= 0.5 then -- temporarily to minimize debris | |
2306 | pcall(Game.Destroy, part) | |
2307 | else | |
2308 | local cframe = part.CFrame | |
2309 | part.Anchored = false | |
2310 | part.BrickColor = BrickColor.new("Medium stone grey") | |
2311 | part.CanCollide = true | |
2312 | if part:IsA("FormFactorPart") then | |
2313 | part.FormFactor = "Custom" | |
2314 | end | |
2315 | part.Size = size - Vector3.new(0.135, 0.135, 0.135) * fragmentation_size | |
2316 | part.Transparency = part_transparency | |
2317 | part.CFrame = cframe + direction * 5 | |
2318 | part.Velocity = part.Velocity + direction * 40 | |
2319 | end | |
2320 | elseif is_block then | |
2321 | local parts = {part} | |
2322 | local model = Instance.new("Model", part.Parent) | |
2323 | model.Name = "Fragments" | |
2324 | if size.X >= fragmentation_size then | |
2325 | size = Vector3.new(0.5, 1, 1) * size | |
2326 | local archivable = part.Archivable | |
2327 | local cframe = part.CFrame | |
2328 | part.FormFactor = "Custom" | |
2329 | part.Size = size | |
2330 | part.Archivable = true | |
2331 | local part_clone = part:Clone() | |
2332 | part.Archivable = archivable | |
2333 | part_clone.Archivable = archivable | |
2334 | part.CFrame = cframe * CFrame.new(-0.5 * size.X, 0, 0) | |
2335 | part_clone.CFrame = cframe * CFrame.new(0.5 * size.X, 0, 0) | |
2336 | part_clone.Parent = model | |
2337 | parts[2] = part_clone | |
2338 | end | |
2339 | if size.Y >= fragmentation_size then | |
2340 | size = Vector3.new(1, 0.5, 1) * size | |
2341 | for part_index = 1, #parts do | |
2342 | local part = parts[part_index] | |
2343 | local archivable = part.Archivable | |
2344 | local cframe = part.CFrame | |
2345 | part.FormFactor = "Custom" | |
2346 | part.Size = size | |
2347 | part.Archivable = true | |
2348 | local part_clone = part:Clone() | |
2349 | part.Archivable = archivable | |
2350 | part_clone.Archivable = archivable | |
2351 | part.CFrame = cframe * CFrame.new(0, -0.5 * size.Y, 0) | |
2352 | part_clone.CFrame = cframe * CFrame.new(0, 0.5 * size.Y, 0) | |
2353 | part_clone.Parent = model | |
2354 | table.insert(parts, part_clone) | |
2355 | end | |
2356 | end | |
2357 | if size.Z >= fragmentation_size then | |
2358 | size = Vector3.new(1, 1, 0.5) * size | |
2359 | for part_index = 1, #parts do | |
2360 | local part = parts[part_index] | |
2361 | local archivable = part.Archivable | |
2362 | local cframe = part.CFrame | |
2363 | part.FormFactor = "Custom" | |
2364 | part.Size = size | |
2365 | part.Archivable = true | |
2366 | local part_clone = part:Clone() | |
2367 | part.Archivable = archivable | |
2368 | part_clone.Archivable = archivable | |
2369 | part.CFrame = cframe * CFrame.new(0, 0, -0.5 * size.Z) | |
2370 | part_clone.CFrame = cframe * CFrame.new(0, 0, 0.5 * size.Z) | |
2371 | part_clone.Parent = model | |
2372 | table.insert(parts, part_clone) | |
2373 | end | |
2374 | end | |
2375 | for _, part in ipairs(parts) do | |
2376 | part:MakeJoints() | |
2377 | end | |
2378 | else | |
2379 | break | |
2380 | end | |
2381 | end | |
2382 | else | |
2383 | laser_distance = 9990 | |
2384 | break | |
2385 | end | |
2386 | end | |
2387 | end | |
2388 | end | |
2389 | local laser_cframe = magic_circle_cframe * CFrame.Angles(-0.5 * math.pi, 0, 0) | |
2390 | local laser_width = GraphicalEffects.LASER_WIDTH * opacity * laser_scale | |
2391 | local laser_mesh_offset = Vector3.new(0, 0.5 * laser_distance, 0) | |
2392 | laser_part.CFrame = laser_cframe | |
2393 | if laser_effects then | |
2394 | local laser_effect_data_1, laser_effect_data_2 = laser_effects[1], laser_effects[2] | |
2395 | local laser_effect_1, laser_effect_mesh_1 = laser_effect_data_1[1], laser_effect_data_1[2] | |
2396 | local laser_effect_2, laser_effect_mesh_2 = laser_effect_data_2[1], laser_effect_data_2[2] | |
2397 | laser_effect_1.CFrame = laser_cframe | |
2398 | laser_effect_2.CFrame = laser_cframe | |
2399 | laser_effect_mesh_1.Offset = laser_mesh_offset | |
2400 | laser_effect_mesh_2.Offset = laser_mesh_offset | |
2401 | local game_time = time() | |
2402 | local effect_scale_1 = 0.5 + 0.5 * math.sin(16 * math.pi * game_time) | |
2403 | local effect_scale_2 = 0.5 + 0.5 * math.cos(16 * math.pi * game_time) | |
2404 | laser_effect_mesh_1.Scale = 5 * Vector3.new(laser_width * effect_scale_1, laser_distance, laser_width * effect_scale_1) | |
2405 | laser_effect_mesh_2.Scale = 5 * Vector3.new(laser_width * effect_scale_2, laser_distance, laser_width * effect_scale_2) | |
2406 | laser_width = laser_width * 0.25 | |
2407 | end | |
2408 | laser_mesh.Offset = laser_mesh_offset | |
2409 | laser_mesh.Scale = 5 * Vector3.new(laser_width, laser_distance, laser_width) | |
2410 | magic_circle_part.CFrame = magic_circle_cframe | |
2411 | magic_circle_light.Brightness = opacity | |
2412 | magic_circle_decal_back.Transparency = transparency | |
2413 | magic_circle_decal_front.Transparency = transparency | |
2414 | if light_effects then | |
2415 | for index, data in ipairs(laser_lights) do | |
2416 | local laser_spotlight_part, laser_spotlight = data[1], data[2] | |
2417 | local laser_spotlight_offset = 30 * (index - 1) | |
2418 | if laser_spotlight_offset <= laser_distance then | |
2419 | laser_spotlight_part.CFrame = magic_circle_cframe * CFrame.new(0, 0, -laser_spotlight_offset) | |
2420 | laser_spotlight.Brightness = opacity | |
2421 | laser_spotlight.Enabled = true | |
2422 | else | |
2423 | laser_spotlight.Enabled = false | |
2424 | end | |
2425 | end | |
2426 | end | |
2427 | end | |
2428 | end | |
2429 | function GraphicalEffects.ShootLaserOfDeath(target, data) | |
2430 | if chatAdornee then | |
2431 | data = data or {} | |
2432 | local brickcolor = data.brickcolor or BrickColor.new("Really black") | |
2433 | local duration = data.duration or 40 | |
2434 | local fragmentation_size = data.fragmentation_size or 3 | |
2435 | local laser_scale = data.laser_scale or 1 | |
2436 | local light_color = data.light_color or Color3.new(1, 0.5, 1) | |
2437 | local magic_circle_image = data.magic_circle_image or "rbxassetid://122610943" | |
2438 | local magic_circle_scale = data.magic_circle_scale or 1 | |
2439 | local sound_volume = data.sound_volume or 1 / 3 | |
2440 | local special_effects = data.special_effects | |
2441 | local stay = data.stay or 4 | |
2442 | local origin = chatAdornee.CFrame | |
2443 | local directionOrientation = origin:pointToObjectSpace(target) | |
2444 | local direction = (target - origin.p).unit | |
2445 | local magic_circle_position = origin.p + direction * GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE | |
2446 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) | |
2447 | local magic_circle_model = Instance.new("Model") | |
2448 | local laser_part = Instance.new("Part", magic_circle_model) | |
2449 | local laser_mesh = Instance.new("CylinderMesh", laser_part) | |
2450 | local magic_circle_part = Instance.new("Part", magic_circle_model) | |
2451 | local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part) | |
2452 | local magic_circle_light = Instance.new("PointLight", magic_circle_part) | |
2453 | local magic_circle_decal_back = Instance.new("Decal", magic_circle_part) | |
2454 | local magic_circle_decal_front = Instance.new("Decal", magic_circle_part) | |
2455 | local sound = Instance.new("Sound", magic_circle_part) | |
2456 | sound.Pitch = 1.25 | |
2457 | sound.SoundId = "rbxassetid://2248511" | |
2458 | sound.Volume = sound_volume | |
2459 | magic_circle_model.Archivable = false | |
2460 | laser_part.Anchored = true | |
2461 | laser_part.BottomSurface = "Smooth" | |
2462 | laser_part.BrickColor = brickcolor | |
2463 | laser_part.CanCollide = false | |
2464 | laser_part.CFrame = magic_circle_cframe * CFrame.Angles(-0.5 * math.pi, 0, 0) | |
2465 | laser_part.FormFactor = "Custom" | |
2466 | laser_part.Locked = true | |
2467 | laser_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
2468 | laser_part.TopSurface = "Smooth" | |
2469 | laser_mesh.Offset = Vector3.new(0, 0, 0) | |
2470 | laser_mesh.Name = "Mesh" | |
2471 | laser_mesh.Scale = 5 * laser_scale * Vector3.new(GraphicalEffects.LASER_WIDTH, 0, GraphicalEffects.LASER_WIDTH) | |
2472 | magic_circle_part.Anchored = true | |
2473 | magic_circle_part.BottomSurface = "Smooth" | |
2474 | magic_circle_part.CanCollide = false | |
2475 | magic_circle_part.CFrame = magic_circle_cframe | |
2476 | magic_circle_part.FormFactor = "Custom" | |
2477 | magic_circle_part.Locked = true | |
2478 | magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
2479 | magic_circle_part.TopSurface = "Smooth" | |
2480 | magic_circle_part.Transparency = 1 | |
2481 | magic_circle_mesh.Scale = Vector3.new(60, 60, 0) * magic_circle_scale | |
2482 | magic_circle_light.Color = light_color | |
2483 | magic_circle_light.Range = 16 * magic_circle_scale | |
2484 | magic_circle_light.Shadows = true | |
2485 | magic_circle_decal_back.Face = "Back" | |
2486 | magic_circle_decal_back.Texture = magic_circle_image | |
2487 | magic_circle_decal_front.Face = "Front" | |
2488 | magic_circle_decal_front.Texture = magic_circle_image | |
2489 | magic_circle_model.Parent = Workspace | |
2490 | local laser_color = brickcolor.Color | |
2491 | local laser_lights = {} | |
2492 | local light_effects = laser_color.r + laser_color.g + laser_color.b > 0.25 | |
2493 | if light_effects then | |
2494 | local laser_spotlight_part_template = Instance.new("Part") | |
2495 | local laser_spotlight_light_template = Instance.new("SpotLight", laser_spotlight_part_template) | |
2496 | laser_spotlight_part_template.Anchored = true | |
2497 | laser_spotlight_part_template.Anchored = true | |
2498 | laser_spotlight_part_template.BottomSurface = "Smooth" | |
2499 | laser_spotlight_part_template.CanCollide = false | |
2500 | laser_spotlight_part_template.FormFactor = "Custom" | |
2501 | laser_spotlight_part_template.Locked = true | |
2502 | laser_spotlight_part_template.Size = Vector3.new(0.2, 0.2, 0.2) | |
2503 | laser_spotlight_part_template.TopSurface = "Smooth" | |
2504 | laser_spotlight_part_template.Transparency = 1 | |
2505 | laser_spotlight_light_template.Angle = 45 | |
2506 | laser_spotlight_light_template.Color = laser_color | |
2507 | laser_spotlight_light_template.Enabled = true | |
2508 | laser_spotlight_light_template.Name = "Light" | |
2509 | laser_spotlight_light_template.Range = 60 | |
2510 | for index = 1, 40 do | |
2511 | local laser_spotlight_part = laser_spotlight_part_template:Clone() | |
2512 | laser_spotlight_part.CFrame = magic_circle_cframe * CFrame.new(0, 0, -30 * (index - 1)) | |
2513 | laser_spotlight_part.Parent = magic_circle_model | |
2514 | laser_lights[index] = {laser_spotlight_part, laser_spotlight_part.Light} | |
2515 | end | |
2516 | end | |
2517 | local laser_effects | |
2518 | if special_effects then | |
2519 | laser_effects = {} | |
2520 | local laser_effect_1 = laser_part:Clone() | |
2521 | laser_effect_1.BrickColor = special_effects | |
2522 | laser_effect_1.Transparency = 0.5 | |
2523 | local laser_effect_2 = laser_effect_1:Clone() | |
2524 | laser_effects[1], laser_effects[2] = {laser_effect_1, laser_effect_1.Mesh}, {laser_effect_2, laser_effect_2.Mesh} | |
2525 | laser_effect_1.Parent = magic_circle_model | |
2526 | laser_effect_2.Parent = magic_circle_model | |
2527 | end | |
2528 | GraphicalEffects.laser_data[{0, directionOrientation, direction, magic_circle_model, laser_part, laser_mesh, magic_circle_part, | |
2529 | ||
2530 | magic_circle_light, magic_circle_decal_back, magic_circle_decal_front, sound, laser_scale, fragmentation_size, duration, laser_lights, laser_effects, stay, | |
2531 | ||
2532 | light_effects}] = true | |
2533 | end | |
2534 | end | |
2535 | ||
2536 | function GraphicalEffects.SpawnSapientRock(position) | |
2537 | local part = Instance.new("Part", Workspace) | |
2538 | local size = 8 + math.random(0, 5) | |
2539 | part.BottomSurface = "Smooth" | |
2540 | part.TopSurface = "Smooth" | |
2541 | part.Material = "Slate" | |
2542 | part.Locked = true | |
2543 | part.Shape = "Ball" | |
2544 | part.FormFactor = "Custom" | |
2545 | part.Size = Vector3.new(size, size, size) | |
2546 | part.Position = position | |
2547 | local bodypos = Instance.new("BodyPosition", part) | |
2548 | bodypos.maxForce = Vector3.new(0, 0, 0) | |
2549 | local angry = false | |
2550 | local damage_ready = true | |
2551 | local torso_following | |
2552 | local torso_changed = -1000 | |
2553 | local touched_conn = part.Touched:connect(function(hit) | |
2554 | local character = hit.Parent | |
2555 | if character then | |
2556 | local humanoid | |
2557 | for _, child in ipairs(character:GetChildren()) do | |
2558 | if child:IsA("Humanoid") then | |
2559 | humanoid = child | |
2560 | break | |
2561 | end | |
2562 | end | |
2563 | if humanoid then | |
2564 | if angry then | |
2565 | if damage_ready then | |
2566 | damage_ready = false | |
2567 | humanoid:TakeDamage(100) | |
2568 | wait(1) | |
2569 | damage_ready = true | |
2570 | angry = false | |
2571 | part.BrickColor = BrickColor.new("Medium stone grey") | |
2572 | end | |
2573 | else | |
2574 | local torso = humanoid.Torso | |
2575 | if torso then | |
2576 | torso_following = torso | |
2577 | torso_changed = tick() | |
2578 | end | |
2579 | end | |
2580 | end | |
2581 | end | |
2582 | end) | |
2583 | TaskScheduler.Start(function() | |
2584 | while part.Parent == Workspace do | |
2585 | if torso_following then | |
2586 | bodypos.position = torso_following.Position | |
2587 | if tick() - torso_changed > 60 or not torso_following.Parent then | |
2588 | torso_following = nil | |
2589 | bodypos.maxForce = Vector3.new(0, 0, 0) | |
2590 | angry = false | |
2591 | part.BrickColor = BrickColor.new("Medium stone grey") | |
2592 | else | |
2593 | local speed = angry and Vector3.new(16, 16, 16) or Vector3.new(6, 0, 6) | |
2594 | bodypos.maxForce = part:GetMass() * speed | |
2595 | if part.Position.Y < -250 then | |
2596 | part.Velocity = Vector3.new() | |
2597 | part.Position = torso_following.Position + Vector3.new(0, 80, 0) | |
2598 | part.BrickColor = BrickColor.new("Bright red") | |
2599 | angry = true | |
2600 | torso_changed = tick() | |
2601 | end | |
2602 | end | |
2603 | end | |
2604 | RunService.Stepped:wait() | |
2605 | end | |
2606 | touched_conn:disconnect() | |
2607 | end) | |
2608 | TaskScheduler.Start(function() | |
2609 | while part.Parent == Workspace do | |
2610 | wait(25 + math.random() * 10) | |
2611 | local next_size = 8 + math.random() * 5 | |
2612 | if math.random(100) == 1 then | |
2613 | next_size = next_size * (2 + 6 * math.random()) | |
2614 | end | |
2615 | next_size = math.floor(next_size + 0.5) | |
2616 | local start_time = tick() | |
2617 | local mesh = Instance.new("SpecialMesh", part) | |
2618 | mesh.MeshType = "Sphere" | |
2619 | repeat | |
2620 | local elapsed_time = tick() - start_time | |
2621 | local alpha = math.cos(elapsed_time * math.pi * 0.5) | |
2622 | local interpolated_size = size * alpha + next_size * (1 - alpha) | |
2623 | local size_vector = Vector3.new(interpolated_size, interpolated_size, interpolated_size) | |
2624 | local cframe = part.CFrame | |
2625 | part.Size = size_vector | |
2626 | part.CFrame = cframe | |
2627 | mesh.Scale = size_vector / part.Size | |
2628 | RunService.Stepped:wait() | |
2629 | until tick() - start_time >= 1 | |
2630 | mesh:Destroy() | |
2631 | local cframe = part.CFrame | |
2632 | part.Size = Vector3.new(next_size, next_size, next_size) | |
2633 | part.CFrame = cframe | |
2634 | size = next_size | |
2635 | end | |
2636 | end) | |
2637 | end | |
2638 | ||
2639 | function GraphicalEffects.MainLoop() | |
2640 | RunService.Stepped:wait() | |
2641 | for data in pairs(GraphicalEffects.magicCircleData) do | |
2642 | GraphicalEffects.AnimateMagicCircle(data) | |
2643 | end | |
2644 | for data in pairs(GraphicalEffects.laser_data) do | |
2645 | GraphicalEffects.AnimateLaserOfDeath(data) | |
2646 | end | |
2647 | for data in pairs(GraphicalEffects.missileData) do | |
2648 | GraphicalEffects.AnimateMissile(data) | |
2649 | end | |
2650 | end | |
2651 | TaskScheduler.Start(function() | |
2652 | while true do | |
2653 | GraphicalEffects.MainLoop() | |
2654 | end | |
2655 | end) | |
2656 | ||
2657 | PlayerControl = {}; | |
2658 | ||
2659 | PlayerControl.fly_acceleration = 10 | |
2660 | PlayerControl.fly_basespeed = 250 | |
2661 | PlayerControl.fly_speed = PlayerControl.fly_basespeed | |
2662 | PlayerControl.featherfallEnabled = true | |
2663 | PlayerControl.pushable = false | |
2664 | PlayerControl.rolling = false | |
2665 | PlayerControl.rollingAngle = 0 | |
2666 | PlayerControl.rollingOffset = 0 | |
2667 | PlayerControl.rollingMaxOffset = 3 | |
2668 | PlayerControl.rollingSpeed = 1 / 50 | |
2669 | PlayerControl.characterEnabled = false | |
2670 | PlayerControl.characterMode = "normal" | |
2671 | local character = nil | |
2672 | local flying, flyingMomentum, flyingTilt = false, Vector3.new(), 0 | |
2673 | local pose, regeneratingHealth, jumpDebounce = "Standing", false, false | |
2674 | -- TODO: make local variables public | |
2675 | local model, bodyColors, leftArmMesh, leftLegMesh, rightArmMesh, rightLegMesh, torsoMesh, wildcardHat, wildcardHandle, wildcardMesh, pants, shirt, humanoid, | |
2676 | ||
2677 | head, leftArm, leftLeg, rightArm, rightLeg, torso, rootPart, rootJoint, face, soundFreeFalling, soundGettingUp, soundRunning, leftHip, leftShoulder, | |
2678 | ||
2679 | rightHip, rightShoulder, neck, wildcardWeld, feetPart, feetWeld, feetTouchInterest, bodyGyro, bodyVelocity, headMesh, torsoLight | |
2680 | local AnimateCharacter | |
2681 | local UserInterface = game:service'UserInputService' | |
2682 | local chatBubbles = {} | |
2683 | local chatCharacterLimit = 240 | |
2684 | function PlayerControl.CreateCharacter() | |
2685 | local characterMode = PlayerControl.characterMode | |
2686 | if characterMode == "normal" then | |
2687 | if not PlayerControl.characterEnabled then | |
2688 | return | |
2689 | end | |
2690 | local appearance = CharacterAppearance.GetDefaultAppearance() | |
2691 | local active = true | |
2692 | local torsoCFrame = (torso and torso.CFrame) or PlayerControl.torso_cframe or CFrame.new(0, 10, 0) | |
2693 | if torsoCFrame.p.Y < -450 then | |
2694 | torsoCFrame = CFrame.new(0, 10, 0) | |
2695 | end | |
2696 | local rootPartCFrame = (rootPart and rootPart.CFrame) or PlayerControl.torso_cframe or CFrame.new(0, 10, 0) | |
2697 | if rootPartCFrame.p.Y < -450 then | |
2698 | rootPartCFrame = CFrame.new(0, 10, 0) | |
2699 | end | |
2700 | local cameraCFrame = Camera.CoordinateFrame | |
2701 | local connections = {} | |
2702 | local feetTouching = {} | |
2703 | local previousWalkSpeed = 0 | |
2704 | local prevLeftHip, prevLeftShoulder, prevRightHip, prevRightShoulder = leftHip, leftShoulder, rightHip, rightShoulder | |
2705 | model = Instance.new("Model") | |
2706 | humanoid = Instance.new("Humanoid", model) | |
2707 | head = Instance.new("Part", model) | |
2708 | leftArm = Instance.new("Part", model) | |
2709 | leftLeg = Instance.new("Part", model) | |
2710 | rightArm = Instance.new("Part", model) | |
2711 | rightLeg = Instance.new("Part", model) | |
2712 | torso = Instance.new("Part", model) | |
2713 | rootPart = Instance.new("Part", model) | |
2714 | soundFallingDown = Instance.new("Sound", head) | |
2715 | soundFreeFalling = Instance.new("Sound", head) | |
2716 | soundGettingUp = Instance.new("Sound", head) | |
2717 | soundJumping = Instance.new("Sound", head) | |
2718 | soundRunning = Instance.new("Sound", head) | |
2719 | leftHip = Instance.new("Motor", torso) | |
2720 | leftShoulder = Instance.new("Motor", torso) | |
2721 | rightHip = Instance.new("Motor", torso) | |
2722 | rightShoulder = Instance.new("Motor", torso) | |
2723 | neck = Instance.new("Motor", torso) | |
2724 | rootJoint = Instance.new("Motor", rootPart) | |
2725 | feetPart = Instance.new("Part", model) | |
2726 | feetWeld = Instance.new("Weld", torso) | |
2727 | bodyGyro = Instance.new("BodyGyro", rootPart) | |
2728 | bodyVelocity = Instance.new("BodyVelocity", rootPart) | |
2729 | model.Archivable = false | |
2730 | model.Name = user_name or Player.Name | |
2731 | model.PrimaryPart = head | |
2732 | humanoid.LeftLeg = leftLeg | |
2733 | humanoid.RightLeg = rightLeg | |
2734 | humanoid.Torso = rootPart | |
2735 | head.CFrame = torsoCFrame * CFrame.new(0, 1.5, 0) | |
2736 | head.FormFactor = "Symmetric" | |
2737 | head.Locked = true | |
2738 | head.Name = "Head" | |
2739 | head.Size = Vector3.new(2, 1, 1) | |
2740 | head.TopSurface = "Smooth" | |
2741 | leftArm.CanCollide = false | |
2742 | leftArm.CFrame = torsoCFrame * CFrame.new(-1.5, 0, 0) | |
2743 | leftArm.FormFactor = "Symmetric" | |
2744 | leftArm.Locked = true | |
2745 | leftArm.Name = "Left Arm" | |
2746 | leftArm.Size = Vector3.new(1, 2, 1) | |
2747 | leftLeg.BottomSurface = "Smooth" | |
2748 | leftLeg.CanCollide = false | |
2749 | leftLeg.CFrame = torsoCFrame * CFrame.new(-0.5, -2, 0) | |
2750 | leftLeg.FormFactor = "Symmetric" | |
2751 | leftLeg.Locked = true | |
2752 | leftLeg.Name = "Left Leg" | |
2753 | leftLeg.Size = Vector3.new(1, 2, 1) | |
2754 | leftLeg.TopSurface = "Smooth" | |
2755 | rightArm.CanCollide = false | |
2756 | rightArm.CFrame = torsoCFrame * CFrame.new(1.5, 0, 0) | |
2757 | rightArm.FormFactor = "Symmetric" | |
2758 | rightArm.Locked = true | |
2759 | rightArm.Name = "Right Arm" | |
2760 | rightArm.Size = Vector3.new(1, 2, 1) | |
2761 | rightLeg.BottomSurface = "Smooth" | |
2762 | rightLeg.CanCollide = false | |
2763 | rightLeg.CFrame = torsoCFrame * CFrame.new(0.5, -2, 0) | |
2764 | rightLeg.FormFactor = "Symmetric" | |
2765 | rightLeg.Locked = true | |
2766 | rightLeg.Name = "Right Leg" | |
2767 | rightLeg.Size = Vector3.new(1, 2, 1) | |
2768 | rightLeg.TopSurface = "Smooth" | |
2769 | torso.CFrame = torsoCFrame | |
2770 | torso.FormFactor = "Symmetric" | |
2771 | torso.LeftSurface = "Weld" | |
2772 | torso.Locked = true | |
2773 | torso.RightSurface = "Weld" | |
2774 | torso.Name = "Torso" | |
2775 | torso.Size = Vector3.new(2, 2, 1) | |
2776 | rootPart.BottomSurface = "Smooth" | |
2777 | rootPart.BrickColor = BrickColor.Blue() | |
2778 | rootPart.CFrame = rootPartCFrame | |
2779 | rootPart.FormFactor = "Symmetric" | |
2780 | rootPart.LeftSurface = "Weld" | |
2781 | rootPart.Locked = true | |
2782 | rootPart.RightSurface = "Weld" | |
2783 | rootPart.Name = "HumanoidRootPart" | |
2784 | rootPart.Size = Vector3.new(2, 2, 1) | |
2785 | rootPart.TopSurface = "Smooth" | |
2786 | rootPart.Transparency = 1 | |
2787 | soundFreeFalling.Archivable = false | |
2788 | soundFreeFalling.SoundId = "rbxasset://sounds/swoosh.wav" | |
2789 | soundGettingUp.Archivable = false | |
2790 | soundGettingUp.SoundId = "rbxasset://sounds/hit.wav" | |
2791 | soundRunning.Archivable = false | |
2792 | soundRunning.SoundId = "rbxasset://sounds/bfsl-minifigfoots1.mp3" | |
2793 | soundRunning.Looped = true | |
2794 | leftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
2795 | leftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
2796 | leftHip.MaxVelocity = 0.1 | |
2797 | leftHip.Name = "Left Hip" | |
2798 | leftHip.Part0 = torso | |
2799 | leftHip.Part1 = leftLeg | |
2800 | leftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
2801 | leftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
2802 | leftShoulder.MaxVelocity = 0.15 | |
2803 | leftShoulder.Name = "Left Shoulder" | |
2804 | leftShoulder.Part0 = torso | |
2805 | leftShoulder.Part1 = leftArm | |
2806 | rightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
2807 | rightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
2808 | rightHip.MaxVelocity = 0.1 | |
2809 | rightHip.Name = "Right Hip" | |
2810 | rightHip.Part0 = torso | |
2811 | rightHip.Part1 = rightLeg | |
2812 | rightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
2813 | rightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
2814 | rightShoulder.MaxVelocity = 0.15 | |
2815 | rightShoulder.Name = "Right Shoulder" | |
2816 | rightShoulder.Part0 = torso | |
2817 | rightShoulder.Part1 = rightArm | |
2818 | if prevLeftHip then | |
2819 | leftHip.CurrentAngle = prevLeftHip.CurrentAngle | |
2820 | leftHip.DesiredAngle = prevLeftHip.DesiredAngle | |
2821 | end | |
2822 | if prevLeftShoulder then | |
2823 | leftShoulder.CurrentAngle = prevLeftShoulder.CurrentAngle | |
2824 | leftShoulder.DesiredAngle = prevLeftShoulder.DesiredAngle | |
2825 | end | |
2826 | if prevRightHip then | |
2827 | rightHip.CurrentAngle = prevRightHip.CurrentAngle | |
2828 | rightHip.DesiredAngle = prevRightHip.DesiredAngle | |
2829 | end | |
2830 | if prevRightShoulder then | |
2831 | rightShoulder.CurrentAngle = prevRightShoulder.CurrentAngle | |
2832 | rightShoulder.DesiredAngle = prevRightShoulder.DesiredAngle | |
2833 | end | |
2834 | neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
2835 | neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
2836 | neck.Name = "Neck" | |
2837 | neck.Part0 = torso | |
2838 | neck.Part1 = head | |
2839 | rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) | |
2840 | rootJoint.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) | |
2841 | rootJoint.Name = "RootJoint" | |
2842 | rootJoint.Part0 = rootPart | |
2843 | rootJoint.Part1 = torso | |
2844 | feetPart.BottomSurface = "Smooth" | |
2845 | feetPart.CanCollide = false | |
2846 | feetPart.CFrame = torsoCFrame * CFrame.new(0, -3.1, 0) | |
2847 | feetPart.FormFactor = "Custom" | |
2848 | feetPart.Locked = true | |
2849 | feetPart.Name = "Platform" | |
2850 | feetPart.Size = Vector3.new(1.8, 0.2, 0.8) | |
2851 | feetPart.TopSurface = "Smooth" | |
2852 | feetPart.Transparency = 1 | |
2853 | feetWeld.C0 = CFrame.new(0, -3, 0) | |
2854 | feetWeld.C1 = CFrame.new(0, 0.1, 0) | |
2855 | feetWeld.Name = "PlatformWeld" | |
2856 | feetWeld.Part0 = torso | |
2857 | feetWeld.Part1 = feetPart | |
2858 | table.insert(connections, feetPart.Touched:connect(function(hit) | |
2859 | feetTouching[hit] = true | |
2860 | end)) | |
2861 | table.insert(connections, feetPart.TouchEnded:connect(function(hit) | |
2862 | feetTouching[hit] = nil | |
2863 | end)) | |
2864 | feetTouchInterest = feetPart:FindFirstChild("TouchInterest") | |
2865 | bodyGyro.D = 3250 | |
2866 | bodyGyro.P = 400000 | |
2867 | bodyGyro.maxTorque = Vector3.new(1000000000, 0, 1000000000) | |
2868 | bodyVelocity.P = 5000 | |
2869 | bodyVelocity.maxForce = Vector3.new(0, 0, 0) | |
2870 | bodyVelocity.velocity = Vector3.new(0, 0, 0) | |
2871 | torsoLight = Instance.new("PointLight", torso) | |
2872 | torsoLight.Brightness = 0.4 | |
2873 | torsoLight.Color = Color3.new(1, 1, 1) | |
2874 | torsoLight.Range = 16 | |
2875 | torsoLight.Shadows = true | |
2876 | local ff1, ff2, ff3, ff4, ff5, ff6, ff7, ff8, ff9 = Instance.new("ForceField", head), Instance.new("ForceField", leftArm), Instance.new("ForceField", leftLeg), Instance.new("ForceField", rightArm), Instance.new("ForceField", rightLeg), Instance.new("ForceField", torso), Instance.new("ForceField", wildcardHandle), Instance.new("ForceField", feetPart), Instance.new("ForceField", rootPart) | |
2877 | local forcefields = {[ff1] = head, [ff2] = leftArm, [ff3] = leftLeg, [ff4] = rightArm, [ff5] = rightLeg, [ff6] = torso, [ff7] = wildcardHandle, [ff8] = feetPart, [ff9] = rootPart} | |
2878 | local objects = {[humanoid] = true, [head] = true, [leftArm] = true, [leftLeg] = true, [rightArm] = true, [rightLeg] = true, [torso] = true, [rootPart] = true, [rootJoint] = true, [soundFreeFalling] = true, [soundGettingUp] = true, [soundRunning] = true, [leftHip] = true, [leftShoulder] = true, [rightHip] = true, [rightShoulder] = true, [neck] = true, [feetPart] = true, [feetWeld] = true, [feetTouchInterest] = true, [bodyGyro] = true, [bodyVelocity] = true, [ff1] = true, [ff2] = true, [ff3] = true, [ff4] = true, [ff5] = true, [ff6] = true, [ff7] = true, [ff8] = true, [ff9] = true} | |
2879 | local tshirtUrl = appearance.tshirt | |
2880 | if tshirtUrl then | |
2881 | local tshirt = Instance.new("Decal", torso) | |
2882 | tshirt.Name = "roblox" | |
2883 | tshirt.Texture = tshirtUrl | |
2884 | objects[tshirt] = true | |
2885 | end | |
2886 | for _, template in ipairs(appearance.characterObjects) do | |
2887 | local object = template:Clone() | |
2888 | local newObjects = {object} | |
2889 | for _, object in ipairs(newObjects) do | |
2890 | objects[object] = true | |
2891 | for _, child in ipairs(object:GetChildren()) do | |
2892 | table.insert(newObjects, child) | |
2893 | end | |
2894 | end | |
2895 | if object:IsA("BodyColors") then | |
2896 | head.BrickColor = object.HeadColor | |
2897 | leftArm.BrickColor = object.LeftArmColor | |
2898 | leftLeg.BrickColor = object.LeftLegColor | |
2899 | rightArm.BrickColor = object.RightArmColor | |
2900 | rightLeg.BrickColor = object.RightLegColor | |
2901 | torso.BrickColor = object.TorsoColor | |
2902 | elseif object:IsA("Hat") then | |
2903 | local handle = object:FindFirstChild("Handle") | |
2904 | if handle and handle:IsA("BasePart") then | |
2905 | local weld = Instance.new("Weld", head) | |
2906 | weld.C0 = CFrame.new(0, 0.5, 0) | |
2907 | local attachmentPos = object.AttachmentPos | |
2908 | local attachmentRight = object.AttachmentRight | |
2909 | local attachmentUp = object.AttachmentUp | |
2910 | local attachmentForward = object.AttachmentForward | |
2911 | weld.C1 = CFrame.new(attachmentPos.X, attachmentPos.Y, attachmentPos.Z, | |
2912 | attachmentRight.X, attachmentUp.X, -attachmentForward.X, | |
2913 | attachmentRight.Y, attachmentUp.Y, -attachmentForward.Y, | |
2914 | attachmentRight.Z, attachmentUp.Z, -attachmentForward.Z) | |
2915 | weld.Name = "HeadWeld" | |
2916 | weld.Part0 = head | |
2917 | weld.Part1 = handle | |
2918 | handle.Parent = model | |
2919 | local antiGravity = Instance.new("BodyForce", handle) | |
2920 | antiGravity.force = Vector3.new(0, handle:GetMass() * 196.2, 0) | |
2921 | objects[object] = false | |
2922 | object.Parent = nil | |
2923 | objects[weld] = true | |
2924 | end | |
2925 | end | |
2926 | object.Parent = model | |
2927 | end | |
2928 | local facePresent = false | |
2929 | local headMeshPresent = false | |
2930 | for _, template in ipairs(appearance.headObjects) do | |
2931 | local object = template:Clone() | |
2932 | local newObjects = {object} | |
2933 | for _, object in ipairs(newObjects) do | |
2934 | objects[object] = true | |
2935 | for _, child in ipairs(object:GetChildren()) do | |
2936 | table.insert(newObjects, child) | |
2937 | end | |
2938 | end | |
2939 | if object:IsA("DataModelMesh") then | |
2940 | headMeshPresent = true | |
2941 | elseif object:IsA("Decal") then | |
2942 | facePresent = true | |
2943 | end | |
2944 | object.Parent = head | |
2945 | end | |
2946 | if not facePresent then | |
2947 | local face = Instance.new("Decal", head) | |
2948 | face.Texture = "rbxasset://textures/face.png" | |
2949 | objects[face] = true | |
2950 | end | |
2951 | if not headMeshPresent then | |
2952 | local headMesh = Instance.new("SpecialMesh", head) | |
2953 | headMesh.Scale = Vector3.new(1.25, 1.25, 1.25) | |
2954 | objects[headMesh] = true | |
2955 | end | |
2956 | table.insert(connections, model.DescendantAdded:connect(function(object) | |
2957 | local success, is_localscript = pcall(Game.IsA, object, "LocalScript") | |
2958 | if success and is_localscript then | |
2959 | pcall(Utility.SetProperty, object, "Disabled", true) | |
2960 | local changed_connection = pcall(object.Changed.connect, object.Changed, function(property) | |
2961 | if property == "Disabled" and not object.Disabled then | |
2962 | pcall(Utility.SetProperty, object, "Disabled", true) | |
2963 | object:Destroy() | |
2964 | end | |
2965 | end) | |
2966 | end | |
2967 | if not objects[object] then | |
2968 | object:Destroy() | |
2969 | end | |
2970 | end)) | |
2971 | model.Parent = Workspace | |
2972 | Player.Character = model | |
2973 | Camera.CameraSubject = humanoid | |
2974 | Camera.CameraType = "Track" | |
2975 | Camera.CoordinateFrame = cameraCFrame | |
2976 | local IsStanding | |
2977 | local RegenerateHealth | |
2978 | local ResetCharacter | |
2979 | function IsStanding() | |
2980 | return not not next(feetTouching) | |
2981 | end | |
2982 | function RegenerateHealth() | |
2983 | if humanoid.Health < 1 then | |
2984 | humanoid.Health = 100 | |
2985 | elseif not regeneratingHealth then | |
2986 | regeneratingHealth = true | |
2987 | local elapsedTime = wait(1) | |
2988 | regeneratingHealth = false | |
2989 | if humanoid.Health < 100 then | |
2990 | humanoid.Health = math.min(humanoid.Health + elapsedTime, 100) | |
2991 | end | |
2992 | end | |
2993 | end | |
2994 | function ResetCharacter() | |
2995 | for index, connection in ipairs(connections) do | |
2996 | connection:disconnect() | |
2997 | end | |
2998 | active = false | |
2999 | end | |
3000 | table.insert(connections, model.AncestryChanged:connect(ResetCharacter)) | |
3001 | table.insert(connections, model.DescendantRemoving:connect(function(object) | |
3002 | local parent = forcefields[object] | |
3003 | if parent then | |
3004 | forcefields[object] = nil | |
3005 | local new_forcefield = Instance.new("ForceField") | |
3006 | forcefields[new_forcefield] = parent | |
3007 | objects[new_forcefield] = true | |
3008 | new_forcefield.Parent = parent | |
3009 | elseif objects[object] then | |
3010 | ResetCharacter() | |
3011 | end | |
3012 | end)) | |
3013 | table.insert(connections, humanoid.HealthChanged:connect(RegenerateHealth)) | |
3014 | table.insert(connections, humanoid.Climbing:connect(function() pose = "Climbing" end)) | |
3015 | table.insert(connections, humanoid.FallingDown:connect(function(state) pose = "FallingDown" end)) | |
3016 | table.insert(connections, humanoid.FreeFalling:connect(function(state) pose = "FreeFall" if state then soundFreeFalling:Play() else | |
3017 | ||
3018 | soundFreeFalling:Pause() end end)) | |
3019 | table.insert(connections, humanoid.GettingUp:connect(function(state) pose = "GettingUp" if state then soundGettingUp:Play() else | |
3020 | ||
3021 | soundGettingUp:Pause() end end)) | |
3022 | table.insert(connections, humanoid.PlatformStanding:connect(function() pose = "PlatformStanding" end)) | |
3023 | table.insert(connections, humanoid.Seated:connect(function() pose = "Seated" end)) | |
3024 | table.insert(connections, humanoid.Swimming:connect(function(speed) if speed > 0 then pose = "Swimming" else pose = "Standing" end end)) | |
3025 | local previousRootPartCFrame = rootPart.CFrame | |
3026 | TaskScheduler.Start(function() | |
3027 | while active do | |
3028 | local totalTime = TaskScheduler.GetCurrentTime() | |
3029 | local stepTime = 1 / 60 | |
3030 | if not PlayerControl.characterEnabled then | |
3031 | ResetCharacter() | |
3032 | break | |
3033 | end | |
3034 | torsoLight.Brightness = 0.5 + 0.15 * math.sin(totalTime * 0.75 * math.pi) | |
3035 | local featherfallEnabled = PlayerControl.IsFeatherfallEnabled() | |
3036 | local rootPartCFrame = rootPart.CFrame | |
3037 | if not jumpDebounce and UserInterface:IsKeyDown(Enum.KeyCode.Space) then | |
3038 | if humanoid.Sit then | |
3039 | humanoid.Sit = false | |
3040 | end | |
3041 | if IsStanding() then | |
3042 | jumpDebounce = true | |
3043 | pose = "Jumping" | |
3044 | rootPart.Velocity = Vector3.new(rootPart.Velocity.X, 50, rootPart.Velocity.Z) | |
3045 | torso.Velocity = Vector3.new(torso.Velocity.X, 50, torso.Velocity.Z) | |
3046 | TaskScheduler.Schedule(1, function() | |
3047 | if pose == "Jumping" then | |
3048 | pose = "FreeFall" | |
3049 | end | |
3050 | jumpDebounce = false | |
3051 | humanoid.Jump = false | |
3052 | end) | |
3053 | end | |
3054 | end | |
3055 | local cameraCFrame = Camera.CoordinateFrame | |
3056 | local cameraDirection = cameraCFrame.lookVector | |
3057 | if flying then | |
3058 | if PlayerControl.rolling then | |
3059 | local rootPartCFrame = rootPart.CFrame | |
3060 | local speed = (rootPartCFrame - rootPartCFrame.p):pointToObjectSpace(rootPart.Velocity).Y | |
3061 | local decay = 0.5 ^ stepTime | |
3062 | if math.abs(speed) <= 50 then | |
3063 | PlayerControl.rollingAngle = (((PlayerControl.rollingAngle + 0.5) % 1 - 0.5) * decay) % 1 | |
3064 | PlayerControl.rollingOffset = PlayerControl.rollingOffset * decay | |
3065 | else | |
3066 | PlayerControl.rollingAngle = (PlayerControl.rollingAngle + stepTime * speed * PlayerControl.rollingSpeed) % 1 | |
3067 | PlayerControl.rollingOffset = (PlayerControl.rollingOffset + PlayerControl.rollingMaxOffset * (1 / decay - 1)) * decay | |
3068 | end | |
3069 | rootJoint.C0 = (CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) * CFrame.Angles(PlayerControl.rollingAngle * 2 * math.pi, 0, 0)) * CFrame.new(0, -PlayerControl.rollingOffset, 0) | |
3070 | else | |
3071 | rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) | |
3072 | PlayerControl.rollingAngle = 0 | |
3073 | PlayerControl.rollingOffset = 0 | |
3074 | end | |
3075 | rightShoulder.MaxVelocity = 0.5 | |
3076 | leftShoulder.MaxVelocity = 0.5 | |
3077 | rightShoulder.DesiredAngle = 0 | |
3078 | leftShoulder.DesiredAngle = 0 | |
3079 | rightHip.DesiredAngle = 0 | |
3080 | leftHip.DesiredAngle = 0 | |
3081 | bodyGyro.D = 500 | |
3082 | bodyGyro.P = 1e6 | |
3083 | bodyGyro.maxTorque = Vector3.new(1e6, 1e6, 1e6) | |
3084 | bodyVelocity.P = 1250 | |
3085 | bodyVelocity.maxForce = Vector3.new(1e6, 1e6, 1e6) | |
3086 | local movementRight = 0 | |
3087 | local movementForward = 0 | |
3088 | local movementUp = 0 | |
3089 | if UserInterface:IsKeyDown(Enum.KeyCode.A) and not UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
3090 | movementRight = -1 | |
3091 | elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
3092 | movementRight = 1 | |
3093 | end | |
3094 | if UserInterface:IsKeyDown(Enum.KeyCode.W) then | |
3095 | movementUp = 0.2 | |
3096 | if not UserInterface:IsKeyDown(Enum.KeyCode.S) then | |
3097 | movementForward = -1 | |
3098 | end | |
3099 | elseif UserInterface:IsKeyDown(Enum.KeyCode.S) then | |
3100 | movementForward = 1 | |
3101 | end | |
3102 | local movement = PlayerControl.fly_acceleration * cameraCFrame:vectorToWorldSpace(Vector3.new(movementRight, movementUp, movementForward)) | |
3103 | local previousMomentum = flyingMomentum | |
3104 | local previousTilt = flyingTilt | |
3105 | flyingMomentum = movement + flyingMomentum * (1 - PlayerControl.fly_acceleration / PlayerControl.fly_speed) | |
3106 | flyingTilt = ((flyingMomentum * Vector3.new(1, 0, 1)).unit:Cross((previousMomentum * Vector3.new(1, 0, 1)).unit)).Y | |
3107 | if flyingTilt ~= flyingTilt or flyingTilt == math.huge then | |
3108 | flyingTilt = 0 | |
3109 | end | |
3110 | local absoluteTilt = math.abs(flyingTilt) | |
3111 | if absoluteTilt > 0.06 or absoluteTilt < 0.0001 then | |
3112 | if math.abs(previousTilt) > 0.0001 then | |
3113 | flyingTilt = previousTilt * 0.9 | |
3114 | else | |
3115 | flyingTilt = 0 | |
3116 | end | |
3117 | else | |
3118 | flyingTilt = previousTilt * 0.77 + flyingTilt * 0.25 | |
3119 | end | |
3120 | previousTilt = flyingTilt | |
3121 | if flyingMomentum.magnitude < 0.1 then | |
3122 | flyingMomentum = Vector3.new(0, 0, 0) | |
3123 | -- bodyGyro.cframe = cameraCFrame | |
3124 | else | |
3125 | local momentumOrientation = CFrame.new(Vector3.new(0, 0, 0), flyingMomentum) | |
3126 | local tiltOrientation = CFrame.Angles(0, 0, -20 * flyingTilt) | |
3127 | bodyGyro.cframe = momentumOrientation * tiltOrientation * CFrame.Angles(-0.5 * math.pi * math.min(flyingMomentum.magnitude / PlayerControl.fly_speed, 1), 0, 0) | |
3128 | end | |
3129 | bodyVelocity.velocity = flyingMomentum + Vector3.new(0, 0.15695775618683547, 0) | |
3130 | rootPart.Velocity = flyingMomentum | |
3131 | previousMomentum = flyingMomentum | |
3132 | else | |
3133 | rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) | |
3134 | PlayerControl.rollingAngle = 0 | |
3135 | PlayerControl.rollingOffset = 0 | |
3136 | bodyGyro.D = 3250 | |
3137 | bodyGyro.P = 400000 | |
3138 | bodyVelocity.P = 5000 | |
3139 | local cameraDirection = cameraCFrame.lookVector | |
3140 | local walkDirection = Vector3.new(0, 0, 0) | |
3141 | local walkSpeed = 16 | |
3142 | if UserInterface:IsKeyDown(Enum.KeyCode.W) then | |
3143 | if UserInterface:IsKeyDown(Enum.KeyCode.A) then | |
3144 | walkDirection = Vector3.new(cameraDirection.X + cameraDirection.Z, 0, cameraDirection.Z - cameraDirection.X).unit | |
3145 | elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
3146 | walkDirection = Vector3.new(cameraDirection.X - cameraDirection.Z, 0, cameraDirection.Z + cameraDirection.X).unit | |
3147 | else | |
3148 | walkDirection = Vector3.new(cameraDirection.X, 0, cameraDirection.Z).unit | |
3149 | end | |
3150 | elseif UserInterface:IsKeyDown(Enum.KeyCode.S) then | |
3151 | if UserInterface:IsKeyDown(Enum.KeyCode.A) then | |
3152 | walkDirection = Vector3.new(-cameraDirection.X + cameraDirection.Z, 0, -cameraDirection.Z - cameraDirection.X).unit | |
3153 | elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
3154 | walkDirection = Vector3.new(-cameraDirection.X - cameraDirection.Z, 0, -cameraDirection.Z + cameraDirection.X).unit | |
3155 | else | |
3156 | walkDirection = Vector3.new(-cameraDirection.X, 0, -cameraDirection.Z).unit | |
3157 | end | |
3158 | elseif UserInterface:IsKeyDown(Enum.KeyCode.A) then | |
3159 | walkDirection = Vector3.new(cameraDirection.Z, 0, -cameraDirection.X).unit | |
3160 | elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
3161 | walkDirection = Vector3.new(-cameraDirection.Z, 0, cameraDirection.X).unit | |
3162 | else | |
3163 | walkSpeed = 0 | |
3164 | end | |
3165 | if walkSpeed ~= previousWalkSpeed then | |
3166 | if walkSpeed > 0 then | |
3167 | soundRunning:Play() | |
3168 | else | |
3169 | soundRunning:Pause() | |
3170 | end | |
3171 | end | |
3172 | if walkSpeed > 0 then | |
3173 | if pose ~= "Jumping" then | |
3174 | if IsStanding() then | |
3175 | pose = "Running" | |
3176 | else | |
3177 | pose = "FreeFall" | |
3178 | end | |
3179 | end | |
3180 | bodyGyro.cframe = CFrame.new(Vector3.new(), walkDirection) | |
3181 | bodyGyro.maxTorque = Vector3.new(1000000000, 1000000000, 1000000000) | |
3182 | bodyVelocity.maxForce = Vector3.new(1000000, maxForceY, 1000000) | |
3183 | else | |
3184 | if pose ~= "Jumping" then | |
3185 | if IsStanding() then | |
3186 | pose = "Standing" | |
3187 | else | |
3188 | pose = "FreeFall" | |
3189 | end | |
3190 | end | |
3191 | -- TODO: find and fix bug that causes torso to rotate back to some angle | |
3192 | bodyGyro.maxTorque = Vector3.new(1000000000, 1000000000, 1000000000) -- Vector3.new(1000000000, 0, 1000000000) | |
3193 | if PlayerControl.pushable then | |
3194 | bodyVelocity.maxForce = Vector3.new(0, 0, 0) | |
3195 | else | |
3196 | bodyVelocity.maxForce = Vector3.new(1000000, 0, 1000000) | |
3197 | end | |
3198 | end | |
3199 | if featherfallEnabled then | |
3200 | local velocity = rootPart.Velocity | |
3201 | if velocity.Y > 50 then | |
3202 | rootPart.Velocity = Vector3.new(velocity.X, 50, velocity.Z) | |
3203 | elseif velocity.Y < -50 then | |
3204 | rootPart.Velocity = Vector3.new(velocity.X, -50, velocity.Z) | |
3205 | end | |
3206 | local distanceVector = rootPartCFrame.p - previousRootPartCFrame.p | |
3207 | local offsetX, offsetY, offsetZ = distanceVector.X, distanceVector.Y, distanceVector.Z | |
3208 | local MAX_MOVEMENT = 50 * 0.03333333507180214 | |
3209 | if offsetX > MAX_MOVEMENT then | |
3210 | offsetX = MAX_MOVEMENT | |
3211 | elseif offsetX < -MAX_MOVEMENT then | |
3212 | offsetX = -MAX_MOVEMENT | |
3213 | end | |
3214 | if offsetY > MAX_MOVEMENT then | |
3215 | offsetY = MAX_MOVEMENT | |
3216 | elseif offsetY < -MAX_MOVEMENT then | |
3217 | offsetY = -MAX_MOVEMENT | |
3218 | end | |
3219 | if offsetZ > MAX_MOVEMENT then | |
3220 | offsetZ = MAX_MOVEMENT | |
3221 | elseif offsetZ < -MAX_MOVEMENT then | |
3222 | offsetZ = -MAX_MOVEMENT | |
3223 | end | |
3224 | local offset = Vector3.new(offsetX, offsetY, offsetZ) | |
3225 | if offset ~= distanceVector then | |
3226 | rootPartCFrame = previousRootPartCFrame + offset | |
3227 | --rootPart.CFrame = rootPartCFrame | |
3228 | end | |
3229 | end | |
3230 | local walkingVelocity = walkDirection * walkSpeed | |
3231 | bodyVelocity.velocity = walkingVelocity | |
3232 | if not jumpDebounce and math.abs(rootPart.Velocity.Y) <= 0.1 then | |
3233 | rootPart.Velocity = Vector3.new(walkingVelocity.X, rootPart.Velocity.Y, walkingVelocity.Z) | |
3234 | end | |
3235 | previousWalkSpeed = walkSpeed | |
3236 | if pose == "Jumping" or jumpDebounce then | |
3237 | rightShoulder.MaxVelocity = 0.5 | |
3238 | leftShoulder.MaxVelocity = 0.5 | |
3239 | rightShoulder.DesiredAngle = 3.14 | |
3240 | leftShoulder.DesiredAngle = -3.14 | |
3241 | rightHip.DesiredAngle = 0 | |
3242 | leftHip.DesiredAngle = 0 | |
3243 | elseif pose == "FreeFall" then | |
3244 | rightShoulder.MaxVelocity = 0.5 | |
3245 | leftShoulder.MaxVelocity = 0.5 | |
3246 | rightShoulder.DesiredAngle = 3.14 | |
3247 | leftShoulder.DesiredAngle = -3.14 | |
3248 | rightHip.DesiredAngle = 0 | |
3249 | leftHip.DesiredAngle = 0 | |
3250 | elseif pose == "Seated" then | |
3251 | rightShoulder.MaxVelocity = 0.15 | |
3252 | leftShoulder.MaxVelocity = 0.15 | |
3253 | rightShoulder.DesiredAngle = 3.14 / 2 | |
3254 | leftShoulder.DesiredAngle = -3.14 / 2 | |
3255 | rightHip.DesiredAngle = 3.14 / 2 | |
3256 | leftHip.DesiredAngle = -3.14 / 2 | |
3257 | else | |
3258 | local climbFudge = 0 | |
3259 | local amplitude | |
3260 | local frequency | |
3261 | if pose == "Running" then | |
3262 | rightShoulder.MaxVelocity = 0.15 | |
3263 | leftShoulder.MaxVelocity = 0.15 | |
3264 | amplitude = 1 | |
3265 | frequency = 9 | |
3266 | elseif (pose == "Climbing") then | |
3267 | rightShoulder.MaxVelocity = 0.5 | |
3268 | leftShoulder.MaxVelocity = 0.5 | |
3269 | amplitude = 1 | |
3270 | frequency = 9 | |
3271 | climbFudge = 3.14 | |
3272 | else | |
3273 | amplitude = 0.1 | |
3274 | frequency = 1 | |
3275 | end | |
3276 | local desiredAngle = amplitude * math.sin(totalTime * frequency) | |
3277 | rightShoulder.DesiredAngle = desiredAngle + climbFudge | |
3278 | leftShoulder.DesiredAngle = desiredAngle - climbFudge | |
3279 | rightHip.DesiredAngle = -desiredAngle | |
3280 | leftHip.DesiredAngle = -desiredAngle | |
3281 | end | |
3282 | end | |
3283 | previousRootPartCFrame = rootPartCFrame | |
3284 | RunService.RenderStepped:wait() | |
3285 | end | |
3286 | if model.Parent ~= nil then | |
3287 | model.Parent = nil | |
3288 | end | |
3289 | PlayerControl.CreateCharacter() | |
3290 | end) | |
3291 | humanoid.Health = 100 | |
3292 | character = model | |
3293 | chatAdornee = head | |
3294 | elseif characterMode == "pyramid" then | |
3295 | if PlayerControl.characterEnabled then | |
3296 | Camera.CameraType = "Fixed" | |
3297 | PyramidCharacter.camera_distance = (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude | |
3298 | PyramidCharacter.camera_position = Camera.Focus.p | |
3299 | PyramidCharacter.Teleport(Camera.Focus.p) | |
3300 | PyramidCharacter.visible = true | |
3301 | Player.Character = nil | |
3302 | else | |
3303 | PyramidCharacter.visible = false | |
3304 | end | |
3305 | end | |
3306 | end | |
3307 | function PlayerControl.GetCharacter() | |
3308 | return character | |
3309 | end | |
3310 | function PlayerControl.GetHead() | |
3311 | local characterMode = PlayerControl.characterMode | |
3312 | if characterMode == "normal" then | |
3313 | return head | |
3314 | elseif characterMode == "pyramid" then | |
3315 | return PyramidCharacter.core | |
3316 | end | |
3317 | end | |
3318 | function PlayerControl.GetHumanoid() | |
3319 | return humanoid | |
3320 | end | |
3321 | function PlayerControl.GetRootPart() | |
3322 | return rootPart | |
3323 | end | |
3324 | function PlayerControl.GetTorso() | |
3325 | return torso | |
3326 | end | |
3327 | function PlayerControl.IsEnabled() | |
3328 | return PlayerControl.characterEnabled | |
3329 | end | |
3330 | function PlayerControl.IsFeatherfallEnabled() | |
3331 | return PlayerControl.featherfallEnabled | |
3332 | end | |
3333 | function PlayerControl.IsPushable() | |
3334 | return PlayerControl.pushable | |
3335 | end | |
3336 | function PlayerControl.IsRolling() | |
3337 | return PlayerControl.rolling | |
3338 | end | |
3339 | function PlayerControl.ResetCharacter() | |
3340 | if character and character.Parent then | |
3341 | character.Parent = nil | |
3342 | end | |
3343 | PyramidCharacter.visible = false | |
3344 | end | |
3345 | function PlayerControl.SetEnabled(state, no_animation) | |
3346 | state = not not state | |
3347 | if state ~= PlayerControl.characterEnabled then | |
3348 | PlayerControl.characterEnabled = state | |
3349 | local characterMode = PlayerControl.characterMode | |
3350 | if characterMode == "normal" then | |
3351 | local torso = PlayerControl.GetRootPart() | |
3352 | local rootPart = PlayerControl.GetRootPart() | |
3353 | if rootPart then | |
3354 | if PlayerControl.characterEnabled then | |
3355 | local torso_cframe = Camera.Focus:toWorldSpace(PlayerControl.hide_torso_object_cframe) | |
3356 | PlayerControl.torso_cframe = torso_cframe | |
3357 | torso.CFrame = torso_cframe | |
3358 | rootPart.CFrame = torso_cframe | |
3359 | else | |
3360 | PlayerControl.hide_torso_object_cframe = Camera.Focus:toObjectSpace(rootPart.CFrame) | |
3361 | end | |
3362 | else | |
3363 | PlayerControl.torso_cframe = Camera.Focus | |
3364 | end | |
3365 | if PlayerControl.characterEnabled then | |
3366 | PlayerControl.CreateCharacter() | |
3367 | RunService.Stepped:wait() | |
3368 | coroutine.yield() | |
3369 | if not no_animation then | |
3370 | GraphicalEffects.CrystalRing({base_part = PlayerControl.GetTorso(), crystal_color = BrickColor.new("Institutional white"), float_duration = 2}) | |
3371 | end | |
3372 | else | |
3373 | Player.Character = nil | |
3374 | Camera.CameraType = "Fixed" | |
3375 | if not no_animation then | |
3376 | GraphicalEffects.CrystalRing({position = PlayerControl.GetTorso().Position, crystal_color = BrickColor.new("Institutional white"), float_duration = 2}) | |
3377 | end | |
3378 | end | |
3379 | else | |
3380 | if state then | |
3381 | PlayerControl.CreateCharacter() | |
3382 | RunService.Stepped:wait() | |
3383 | coroutine.yield() | |
3384 | if not no_animation then | |
3385 | GraphicalEffects.CrystalRing({base_part = PyramidCharacter.core, crystal_color = BrickColor.new("Institutional white"), float_duration = 2}) | |
3386 | end | |
3387 | else | |
3388 | PyramidCharacter.visible = false | |
3389 | if not no_animation then | |
3390 | GraphicalEffects.CrystalRing({position = PyramidCharacter.core.Position, crystal_color = BrickColor.new("Institutional white"), float_duration = 2}) | |
3391 | end | |
3392 | end | |
3393 | end | |
3394 | end | |
3395 | end | |
3396 | function PlayerControl.SetFeatherfallEnabled(state) | |
3397 | state = not not state | |
3398 | if state ~= PlayerControl.featherfallEnabled then | |
3399 | PlayerControl.featherfallEnabled = state | |
3400 | if state then | |
3401 | Logger.print("Info", "Featherfall enabled in PlayerControl") | |
3402 | else | |
3403 | Logger.print("Info", "Featherfall disabled in PlayerControl") | |
3404 | end | |
3405 | end | |
3406 | end | |
3407 | function PlayerControl.SetPushable(state) | |
3408 | state = not not state | |
3409 | if state ~= PlayerControl.pushable then | |
3410 | PlayerControl.pushable = state | |
3411 | if state then | |
3412 | Logger.print("Info", "Pushing enabled in PlayerControl") | |
3413 | else | |
3414 | Logger.print("Info", "Pushing disabled in PlayerControl") | |
3415 | end | |
3416 | end | |
3417 | end | |
3418 | function PlayerControl.SetRolling(state) | |
3419 | state = not not state | |
3420 | if state ~= PlayerControl.rolling then | |
3421 | PlayerControl.rolling = state | |
3422 | if state then | |
3423 | Logger.print("Info", "Rolling fly mode enabled in PlayerControl") | |
3424 | else | |
3425 | Logger.print("Info", "Rolling fly mode disabled in PlayerControl") | |
3426 | end | |
3427 | end | |
3428 | end | |
3429 | function PlayerControl.StartFlying() | |
3430 | PlayerControl.fly_speed = PlayerControl.fly_basespeed | |
3431 | if torso then | |
3432 | flyingMomentum = torso.Velocity + torso.CFrame.lookVector * 3 + Vector3.new(0, 10, 0) | |
3433 | else | |
3434 | flyingMomentum = Vector3.new() | |
3435 | end | |
3436 | flyingTilt = 0 | |
3437 | flying = true | |
3438 | end | |
3439 | function PlayerControl.StopFlying() | |
3440 | if bodyGyro.cframe then | |
3441 | local lookVector = bodyGyro.cframe.lookVector | |
3442 | if lookVector.X ~= 0 or lookVector.Z ~= 0 then | |
3443 | bodyGyro.cframe = CFrame.new(Vector3.new(), Vector3.new(lookVector.X, 0, lookVector.Z)) | |
3444 | end | |
3445 | end | |
3446 | flying = false | |
3447 | end | |
3448 | local previousTime = 0 | |
3449 | ||
3450 | ControllerCommands = {}; | |
3451 | ||
3452 | ControllerCommands = {}; | |
3453 | ||
3454 | ControllerCommands.BALEFIRE_SPEED = 40 | |
3455 | function ControllerCommands.BalefireAtMouse() | |
3456 | local head = chatAdornee | |
3457 | if head then | |
3458 | local target = Mouse.Hit.p | |
3459 | local origin = head.Position | |
3460 | local direction = (target - origin).unit | |
3461 | local explosionCount = 0 | |
3462 | local animation_frame = 0 | |
3463 | local magic_circle_position = origin + direction * 4 | |
3464 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) | |
3465 | local magic_circle_part = Instance.new("Part") | |
3466 | local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part) | |
3467 | local magic_circle_light = Instance.new("PointLight", magic_circle_part) | |
3468 | local magic_circle_decal_back = Instance.new("Decal", magic_circle_part) | |
3469 | local magic_circle_decal_front = Instance.new("Decal", magic_circle_part) | |
3470 | magic_circle_part.Anchored = true | |
3471 | magic_circle_part.Archivable = false | |
3472 | magic_circle_part.BottomSurface = "Smooth" | |
3473 | magic_circle_part.CanCollide = false | |
3474 | magic_circle_part.CFrame = magic_circle_cframe | |
3475 | magic_circle_part.FormFactor = "Custom" | |
3476 | magic_circle_part.Locked = true | |
3477 | magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
3478 | magic_circle_part.TopSurface = "Smooth" | |
3479 | magic_circle_part.Transparency = 1 | |
3480 | magic_circle_mesh.Scale = Vector3.new(60, 60, 0) | |
3481 | magic_circle_light.Color = Color3.new(1, 0.5, 1) | |
3482 | magic_circle_light.Range = 16 | |
3483 | magic_circle_light.Shadows = true | |
3484 | magic_circle_decal_back.Face = "Back" | |
3485 | magic_circle_decal_back.Texture = "rbxassetid://122610943" | |
3486 | magic_circle_decal_front.Face = "Front" | |
3487 | magic_circle_decal_front.Texture = "rbxassetid://122610943" | |
3488 | local function NextExplosion() | |
3489 | explosionCount = explosionCount + 1 | |
3490 | Instance.new("Explosion", Workspace).Position = origin + direction * (explosionCount * 8 + 4) | |
3491 | end | |
3492 | local function AnimateMagicCircle() | |
3493 | animation_frame = animation_frame + 1 | |
3494 | local transparency = (animation_frame / 40) ^ 3 | |
3495 | if animation_frame == 40 then | |
3496 | pcall(Game.Destroy, magic_circle_part) | |
3497 | else | |
3498 | if magic_circle_part.Parent ~= Workspace then | |
3499 | pcall(Utility.SetProperty, magic_circle_part, "Parent", Workspace) | |
3500 | end | |
3501 | head = PlayerControl.GetHead() | |
3502 | if head then | |
3503 | magic_circle_position = head.Position + direction * 4 | |
3504 | end | |
3505 | magic_circle_part.CFrame = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, | |
3506 | ||
3507 | math.tau * animation_frame / 40 * 1.5) | |
3508 | magic_circle_light.Brightness = 1 - transparency | |
3509 | magic_circle_decal_back.Transparency = transparency | |
3510 | magic_circle_decal_front.Transparency = transparency | |
3511 | end | |
3512 | end | |
3513 | magic_circle_part.Parent = Workspace | |
3514 | for i = 1, 40 do | |
3515 | Delay((i - 1) / ControllerCommands.BALEFIRE_SPEED, NextExplosion) | |
3516 | Delay((i - 1) / 30, AnimateMagicCircle) | |
3517 | end | |
3518 | for i = 1, 20 do | |
3519 | Delay((i - 1) / ControllerCommands.BALEFIRE_SPEED, NextExplosion) | |
3520 | end | |
3521 | end | |
3522 | end | |
3523 | function ControllerCommands.ControlRandomDummy() | |
3524 | local dummies = {} | |
3525 | local numDummies = 0 | |
3526 | for _, character in ipairs(Workspace:GetChildren()) do | |
3527 | local name = tostring(character) | |
3528 | if name == "???" or name == "Dummy" then | |
3529 | local head, humanoid | |
3530 | for _, child in ipairs(character:GetChildren()) do | |
3531 | local className = child.ClassName | |
3532 | if className == "Part" and tostring(child) == "Head" then | |
3533 | head = child | |
3534 | if humanoid then | |
3535 | break | |
3536 | end | |
3537 | elseif className == "Humanoid" then | |
3538 | if child.Health > 0 then | |
3539 | humanoid = child | |
3540 | if head then | |
3541 | break | |
3542 | end | |
3543 | else | |
3544 | break | |
3545 | end | |
3546 | end | |
3547 | end | |
3548 | if head and humanoid then | |
3549 | numDummies = numDummies + 1 | |
3550 | dummies[numDummies] = {character, head, humanoid} | |
3551 | end | |
3552 | end | |
3553 | end | |
3554 | if numDummies > 0 then | |
3555 | local dummy = dummies[math.random(numDummies)] | |
3556 | Player.Character = dummy[1] | |
3557 | chatAdornee = dummy[2] | |
3558 | Camera.CameraSubject = dummy[3] | |
3559 | Camera.CameraType = "Track" | |
3560 | end | |
3561 | end | |
3562 | function ControllerCommands.Decalify(textures, exclusion) | |
3563 | local objects = Workspace:GetChildren() | |
3564 | for _, object in ipairs(objects) do | |
3565 | if not exclusion[object] then | |
3566 | for _, child in ipairs(object:GetChildren()) do | |
3567 | objects[#objects + 1] = child | |
3568 | end | |
3569 | if object:IsA("BasePart") then | |
3570 | local texture = textures[math.random(#textures)] | |
3571 | local face_left = Instance.new("Decal", object) | |
3572 | face_left.Face = Enum.NormalId.Left | |
3573 | face_left.Texture = texture | |
3574 | local face_right = Instance.new("Decal", object) | |
3575 | face_right.Face = Enum.NormalId.Right | |
3576 | face_right.Texture = texture | |
3577 | local face_bottom = Instance.new("Decal", object) | |
3578 | face_bottom.Face = Enum.NormalId.Bottom | |
3579 | face_bottom.Texture = texture | |
3580 | local face_top = Instance.new("Decal", object) | |
3581 | face_top.Face = Enum.NormalId.Top | |
3582 | face_top.Texture = texture | |
3583 | local face_front = Instance.new("Decal", object) | |
3584 | face_front.Face = Enum.NormalId.Front | |
3585 | face_front.Texture = texture | |
3586 | local face_back = Instance.new("Decal", object) | |
3587 | face_back.Face = Enum.NormalId.Back | |
3588 | face_back.Texture = texture | |
3589 | end | |
3590 | end | |
3591 | end | |
3592 | end | |
3593 | ||
3594 | function ControllerCommands.ExplodeAtMouse() | |
3595 | local explosion = Instance.new("Explosion") | |
3596 | explosion.Position = Mouse.Hit.p | |
3597 | explosion.Parent = Workspace | |
3598 | end | |
3599 | function ControllerCommands.LaserAtMouse() | |
3600 | GraphicalEffects.ShootLaserOfDeath(Mouse.Hit.p) | |
3601 | end | |
3602 | function ControllerCommands.BigLaser(target) | |
3603 | GraphicalEffects.ShootLaserOfDeath(target, {brickcolor = BrickColor.new("New Yeller"), duration = 80, fragmentation_size = 6,laser_scale = 30, light_color = Color3.new(1, 0.5, 0), magic_circle_image = "rbxassetid://126561317", magic_circle_scale = 1.5, sound_volume = 1,special_effects = BrickColor.new("Deep orange"), stay = 2}) | |
3604 | end | |
3605 | function ControllerCommands.BigLaserAtMouse() | |
3606 | ControllerCommands.BigLaser(Mouse.Hit.p) | |
3607 | end | |
3608 | function ControllerCommands.ShootMissile(targetPart, pointOnPart, direction) | |
3609 | GraphicalEffects.ShootMissile(targetPart, pointOnPart, direction) | |
3610 | end | |
3611 | function ControllerCommands.ShootMissileAtMouse(amount, spread, delayTime) | |
3612 | local exclusionList = {} | |
3613 | local playerHead = PlayerControl.GetHead() | |
3614 | local playerTorso = PlayerControl.GetTorso() | |
3615 | if playerHead and playerTorso then | |
3616 | exclusionList[playerTorso] = true | |
3617 | local humanoid, torso = Utility.FindHumanoidClosestToRay(Mouse.UnitRay, exclusionList) | |
3618 | local targetPart, pointOnPart | |
3619 | if humanoid and torso then | |
3620 | targetPart, pointOnPart = torso, Vector3.new() | |
3621 | else | |
3622 | local target = Mouse.Target | |
3623 | if target then | |
3624 | targetPart, pointOnPart = target, target.CFrame:pointToObjectSpace(Mouse.Hit.p) | |
3625 | else | |
3626 | return | |
3627 | end | |
3628 | end | |
3629 | if targetPart then | |
3630 | local direction = (Mouse.Hit.p - playerHead.Position).unit | |
3631 | delayTime = delayTime or 0 | |
3632 | for index = 1, amount do | |
3633 | local angles = math.tau * (index - 0.5) * spread / amount * Vector3.new(math.random() - 0.5, math.random() - 0.5,math.random() - 0.5).unit | |
3634 | TaskScheduler.Schedule(delayTime * (index - 1), ControllerCommands.ShootMissile, targetPart, pointOnPart, CFrame.Angles(angles.X, angles.Y, angles.Z) * direction) | |
3635 | end | |
3636 | end | |
3637 | end | |
3638 | end | |
3639 | function ControllerCommands.ShootMissileAroundMouse(amount, offset, delayTime) | |
3640 | local exclusionList = {} | |
3641 | local playerHead = PlayerControl.GetHead() | |
3642 | local playerTorso = PlayerControl.GetTorso() | |
3643 | if playerHead and playerTorso then | |
3644 | exclusionList[playerTorso] = true | |
3645 | local humanoid, torso = Utility.FindHumanoidClosestToRay(Mouse.UnitRay, exclusionList) | |
3646 | local targetPart, pointOnPart | |
3647 | if humanoid and torso then | |
3648 | targetPart, pointOnPart = torso, Vector3.new() | |
3649 | else | |
3650 | local target = Mouse.Target | |
3651 | if target then | |
3652 | targetPart, pointOnPart = target, target.CFrame:pointToObjectSpace(Mouse.Hit.p) | |
3653 | else | |
3654 | return | |
3655 | end | |
3656 | end | |
3657 | if targetPart then | |
3658 | delayTime = delayTime or 0 | |
3659 | local index = 1 | |
3660 | local targetPoint = targetPart.CFrame * pointOnPart | |
3661 | local rotation_offset_angles = math.tau * Vector3.new(math.random() - 0.5, math.random() - 0.5, 0).unit | |
3662 | local rotation_offset = CFrame.Angles(rotation_offset_angles.x, rotation_offset_angles.y, 0) | |
3663 | local angle_x = 0 | |
3664 | local angle_x_step = math.tau / math.phi | |
3665 | for i = 1, 8 * amount do | |
3666 | angle_x = angle_x + angle_x_step | |
3667 | local direction = rotation_offset * (CFrame.Angles(0, math.tau * index / amount, 0) * CFrame.Angles(angle_x, 0,0).lookVector) | |
3668 | local blocked = Workspace:FindPartOnRay(Ray.new(targetPoint, direction * offset), targetPart.Parent) | |
3669 | if not blocked then | |
3670 | local p0, p1, p2, p3 = targetPart, pointOnPart, direction, offset; GraphicalEffects.ShootMissile(p0, p1, p2, function() return p0 end, p3, true) | |
3671 | index = index + 1 | |
3672 | if index > amount then | |
3673 | break | |
3674 | end | |
3675 | end | |
3676 | end | |
3677 | end | |
3678 | end | |
3679 | end | |
3680 | ||
3681 | function ControllerCommands.HugeExplosionOfDoom(position) | |
3682 | local connections = {} | |
3683 | local parts = {} | |
3684 | local cframe = CFrame.new(position) | |
3685 | local function ExplosionHit(part) | |
3686 | if part:GetMass() < 10000 and part.Parent ~= Camera then | |
3687 | parts[part] = true | |
3688 | part.Anchored = true | |
3689 | part:BreakJoints() | |
3690 | part.BrickColor = BrickColor.new("Instituational white") | |
3691 | end | |
3692 | end | |
3693 | for i = 1, 4 do | |
3694 | local quantity = 0.5 * i * (1 + i) | |
3695 | local fraction = math.tau / quantity | |
3696 | for x = 1, quantity do | |
3697 | for y = 1, quantity do | |
3698 | local explosion = Instance.new("Explosion") | |
3699 | connections[#connections + 1] = explosion.Hit:connect(ExplosionHit) | |
3700 | explosion.BlastRadius = 5 | |
3701 | explosion.Position = cframe * (CFrame.Angles(fraction * x, fraction * y, 0) * Vector3.new((i - 1) * 6, 0, 0)) | |
3702 | explosion.Parent = Workspace | |
3703 | end | |
3704 | end | |
3705 | wait(0.075) | |
3706 | end | |
3707 | for part in pairs(parts) do | |
3708 | for _, child in ipairs(part:GetChildren()) do | |
3709 | if child:IsA("BodyMover") then | |
3710 | child:Destroy() | |
3711 | end | |
3712 | end | |
3713 | local mass = part:GetMass() | |
3714 | local velocity = CFrame.Angles(math.tau * math.random(), math.tau * math.random(), 0) * Vector3.new(25, 0, 0) | |
3715 | local bodythrust = Instance.new("BodyThrust") | |
3716 | bodythrust.force = mass * -velocity | |
3717 | bodythrust.Parent = part | |
3718 | local bodyforce = Instance.new("BodyForce") | |
3719 | bodyforce.force = mass * Vector3.new(0, 196.2, 0) | |
3720 | bodyforce.Parent = part | |
3721 | part.Anchored = false | |
3722 | part.Reflectance = 1 | |
3723 | part.RotVelocity = math.tau * Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5) | |
3724 | part.Transparency = 0.5 | |
3725 | part.Velocity = (part.CFrame - part.Position) * velocity | |
3726 | end | |
3727 | for _, connection in ipairs(connections) do | |
3728 | connection:disconnect() | |
3729 | end | |
3730 | for i = 0, 99 do | |
3731 | Delay(i / 10, function() | |
3732 | for part in pairs(parts) do | |
3733 | local new_transparency = 0.5 * (1 + i / 50) | |
3734 | part.Reflectance = 0.98 * part.Reflectance | |
3735 | if new_transparency > part.Transparency then | |
3736 | part.Transparency = new_transparency | |
3737 | end | |
3738 | end | |
3739 | end) | |
3740 | end | |
3741 | Delay(10, function() | |
3742 | for part in pairs(parts) do | |
3743 | pcall(part.Destroy, part) | |
3744 | end | |
3745 | end) | |
3746 | end | |
3747 | function ControllerCommands.HugeExplosionOfDoomAtMouse() | |
3748 | ControllerCommands.HugeExplosionOfDoom(Mouse.Hit.p) | |
3749 | end | |
3750 | ||
3751 | function ControllerCommands.SpaceHyperBeam(asd) | |
3752 | GraphicalEffects.SpaceHyperBeam(asd) | |
3753 | end | |
3754 | function ControllerCommands.SpaceHyperBeamAtMouse() | |
3755 | ControllerCommands.SpaceHyperBeam(Mouse.Hit.p) | |
3756 | end | |
3757 | function ControllerCommands.ConcentratedSpaceHyperBeamAtMouse() | |
3758 | local p = Mouse.Hit.p; for i = 1, 50 do GraphicalEffects.SpaceHyperBeam(p) end | |
3759 | end | |
3760 | ||
3761 | function ControllerCommands.TeleportCharacterToMouse() | |
3762 | if PlayerControl.IsEnabled() then | |
3763 | local torso = PlayerControl.GetTorso() | |
3764 | if torso then | |
3765 | local pos = Mouse.Hit.p + Vector3.new(0, 5, 0) | |
3766 | torso.CFrame = CFrame.new(pos, pos + torso.CFrame.lookVector) | |
3767 | end | |
3768 | else | |
3769 | local new_focus_position = Mouse.Hit.p | |
3770 | local direction_vector = Camera.CoordinateFrame.lookVector | |
3771 | local new_focus = CFrame.new(new_focus_position, new_focus_position + direction_vector) | |
3772 | Camera.CoordinateFrame = new_focus * CFrame.new(0, 0, 25) | |
3773 | Camera.Focus = new_focus | |
3774 | end | |
3775 | end | |
3776 | ||
3777 | AdvancedGUI = {}; | |
3778 | ||
3779 | if not AdvancedGUI.GUI_BASE_COLOR then | |
3780 | AdvancedGUI.GUI_BASE_COLOR = Color3.new(0, 0, 0) | |
3781 | end | |
3782 | function AdvancedGUI.GenerateChatColor(speakerName) | |
3783 | local chatColor = ChatColor.Get(speakerName).Color | |
3784 | local brightness = chatColor.r + chatColor.g + chatColor.b | |
3785 | if brightness < 1.5 then | |
3786 | chatColor = Color3.new(math.min(1, 0.4 + chatColor.r), math.min(1, 0.4 + chatColor.g), math.min(1, 0.4 + chatColor.b)) | |
3787 | else | |
3788 | chatColor = Color3.new(math.min(1, 0.05 + chatColor.r), math.min(1, 0.05 + chatColor.g), math.min(1, 0.05 + chatColor.b)) | |
3789 | end | |
3790 | return chatColor | |
3791 | end | |
3792 | GuiBase = {} | |
3793 | GuiBase.__index = GuiBase | |
3794 | function GuiBase:new(data) | |
3795 | local instance = setmetatable({}, self) | |
3796 | instance:Init(data) | |
3797 | return instance | |
3798 | end | |
3799 | function GuiBase:Destroy() | |
3800 | if self.parent then | |
3801 | self.parent.children[self] = nil | |
3802 | end | |
3803 | for child in pairs(self.children) do | |
3804 | child:Destroy() | |
3805 | end | |
3806 | self.m_base_instance:Destroy() | |
3807 | end | |
3808 | function GuiBase:GetContentInstance(child) | |
3809 | return self.m_base_instance | |
3810 | end | |
3811 | function GuiBase:Init() | |
3812 | self.children = {} | |
3813 | end | |
3814 | function GuiBase:IsA(className) | |
3815 | return className == "GuiBase" | |
3816 | end | |
3817 | function GuiBase:SetParent(parent) | |
3818 | if parent ~= self.parent then | |
3819 | if self.parent then | |
3820 | self.parent.children[self] = nil | |
3821 | end | |
3822 | self.parent = parent | |
3823 | if parent then | |
3824 | parent.children[self] = true | |
3825 | self.m_base_instance.Parent = parent:GetContentInstance() | |
3826 | else | |
3827 | self.m_base_instance.Parent = nil | |
3828 | end | |
3829 | end | |
3830 | end | |
3831 | GuiObject = setmetatable({}, GuiBase) | |
3832 | GuiObject.__index = GuiObject | |
3833 | function GuiObject:Destroy() | |
3834 | self.DragBegin:disconnect() | |
3835 | self.DragMove:disconnect() | |
3836 | self.DragStopped:disconnect() | |
3837 | self.MouseButton1Click:disconnect() | |
3838 | self.MouseButton1Down:disconnect() | |
3839 | self.MouseButton1Up:disconnect() | |
3840 | self.MouseButton2Down:disconnect() | |
3841 | self.MouseButton2Up:disconnect() | |
3842 | self.MouseEnter:disconnect() | |
3843 | self.MouseLeave:disconnect() | |
3844 | GuiBase.Destroy(self) | |
3845 | end | |
3846 | function GuiObject:GetAbsolutePosition() | |
3847 | return self.m_base_instance.AbsolutePosition | |
3848 | end | |
3849 | function GuiObject:GetAbsoluteSize() | |
3850 | return self.m_base_instance.AbsoluteSize | |
3851 | end | |
3852 | function GuiObject:GetPosition() | |
3853 | return self.position | |
3854 | end | |
3855 | function GuiObject:GetSize() | |
3856 | return self.size | |
3857 | end | |
3858 | function GuiObject:Init() | |
3859 | GuiBase.Init(self) | |
3860 | self.mouseDown = false | |
3861 | self.mouseOver = false | |
3862 | self.DragBegin = RbxUtility.CreateSignal() | |
3863 | self.DragMove = RbxUtility.CreateSignal() | |
3864 | self.DragStopped = RbxUtility.CreateSignal() | |
3865 | self.MouseButton1Click = RbxUtility.CreateSignal() | |
3866 | self.MouseButton1Down = RbxUtility.CreateSignal() | |
3867 | self.MouseButton1Up = RbxUtility.CreateSignal() | |
3868 | self.MouseButton2Down = RbxUtility.CreateSignal() | |
3869 | self.MouseButton2Up = RbxUtility.CreateSignal() | |
3870 | self.MouseEnter = RbxUtility.CreateSignal() | |
3871 | self.MouseLeave = RbxUtility.CreateSignal() | |
3872 | end | |
3873 | function GuiObject:IsA(className) | |
3874 | return className == "GuiObject" or GuiBase.IsA(self, className) | |
3875 | end | |
3876 | function GuiObject:SetActive(active) | |
3877 | if active ~= self.active then | |
3878 | self.active = active | |
3879 | end | |
3880 | end | |
3881 | function GuiObject:SetBackgroundTransparency(backgroundTransparency) | |
3882 | if backgroundTransparency ~= self.backgroundTransparency then | |
3883 | self.backgroundTransparency = backgroundTransparency | |
3884 | self.m_base_instance.BackgroundTransparency = backgroundTransparency | |
3885 | end | |
3886 | end | |
3887 | function GuiObject:SetColor(color) | |
3888 | if color ~= self.color then | |
3889 | self.color = color | |
3890 | self.m_base_instance.BackgroundColor3 = color | |
3891 | end | |
3892 | end | |
3893 | function GuiObject:SetPosition(position) | |
3894 | if position ~= self.position then | |
3895 | self.position = position | |
3896 | self.m_base_instance.Position = position | |
3897 | end | |
3898 | end | |
3899 | function GuiObject:SetSize(size) | |
3900 | if size ~= self.size then | |
3901 | self.size = size | |
3902 | self.m_base_instance.Size = size | |
3903 | end | |
3904 | end | |
3905 | function GuiObject:SetVisible(visible) | |
3906 | if visible ~= self.visible then | |
3907 | self.visible = visible | |
3908 | self.m_base_instance.Visible = visible | |
3909 | end | |
3910 | end | |
3911 | function GuiObject:SetZIndex(zIndex) | |
3912 | local stack = {self.m_base_instance} | |
3913 | repeat | |
3914 | local object = stack[#stack] | |
3915 | stack[#stack] = nil | |
3916 | for _, child in ipairs(object:GetChildren()) do | |
3917 | stack[#stack + 1] = child | |
3918 | end | |
3919 | object.ZIndex = zIndex | |
3920 | until #stack == 0 | |
3921 | end | |
3922 | GuiServiceClass = setmetatable({}, GuiBase) | |
3923 | GuiServiceClass.__index = GuiServiceClass | |
3924 | function GuiServiceClass:CreateTextArea(text, font, fontSize, textColor3, textXAlignment, textYAlignment, maxWidth, minWidth) | |
3925 | local totalHeight = 0 | |
3926 | local frame = Instance.new("Frame") | |
3927 | frame.BackgroundTransparency = 1 | |
3928 | local label = Instance.new("TextLabel") | |
3929 | label.BackgroundTransparency = 1 | |
3930 | label.Font = font | |
3931 | label.FontSize = fontSize | |
3932 | label.TextColor3 = textColor3 | |
3933 | label.TextTransparency = 1 | |
3934 | label.TextWrapped = true | |
3935 | label.TextXAlignment = textXAlignment | |
3936 | label.TextYAlignment = textYAlignment | |
3937 | label.Parent = self.guiFrame | |
3938 | local index = 1 | |
3939 | while true do | |
3940 | local length = #text - index + 1 | |
3941 | if length > 1024 then | |
3942 | length = 1024 | |
3943 | local textBlock = string.sub(text, index, index + length - 1) | |
3944 | label.Text = textBlock | |
3945 | local height = 0 | |
3946 | local width = maxWidth | |
3947 | repeat | |
3948 | height = height + 20 | |
3949 | label.Size = UDim2.new(0, width, 0, height) | |
3950 | until label.TextFits | |
3951 | repeat | |
3952 | height = height - 1 | |
3953 | label.Size = UDim2.new(0, width, 0, height) | |
3954 | until not label.TextFits | |
3955 | repeat | |
3956 | length = length - 10 | |
3957 | label.Text = string.sub(text, index, index + length - 1) | |
3958 | until label.TextFits | |
3959 | repeat | |
3960 | length = length + 1 | |
3961 | label.Text = string.sub(text, index, index + length - 1) | |
3962 | until not label.TextFits | |
3963 | local overflowCharacter = string.sub(text, index + length - 1, index + length - 1) | |
3964 | length = length - 1 | |
3965 | label.Text = string.sub(text, index, index + length - 1) | |
3966 | if overflowCharacter == "\n" then | |
3967 | index = index + 1 | |
3968 | end | |
3969 | repeat | |
3970 | height = height - 1 | |
3971 | label.Size = UDim2.new(0, width, 0, height) | |
3972 | until not label.TextFits | |
3973 | height = height + 1 | |
3974 | local blockLabel = label:Clone() | |
3975 | blockLabel.Position = UDim2.new(0, 0, 0, totalHeight) | |
3976 | blockLabel.Size = UDim2.new(1, 0, 0, height) | |
3977 | blockLabel.Parent = frame | |
3978 | totalHeight = totalHeight + height | |
3979 | index = index + length | |
3980 | else | |
3981 | local textBlock = string.sub(text, index) | |
3982 | label.Text = textBlock | |
3983 | local height = 0 | |
3984 | local width = maxWidth | |
3985 | repeat | |
3986 | height = height + 20 | |
3987 | label.Size = UDim2.new(0, width, 0, height) | |
3988 | until label.TextFits | |
3989 | repeat | |
3990 | height = height - 1 | |
3991 | label.Size = UDim2.new(0, width, 0, height) | |
3992 | until not label.TextFits | |
3993 | height = height + 1 | |
3994 | if index == 1 then | |
3995 | repeat | |
3996 | width = width - 10 | |
3997 | label.Size = UDim2.new(0, width, 0, height) | |
3998 | until width < minWidth or not label.TextFits | |
3999 | width = math.max(width, minWidth - 1) | |
4000 | repeat | |
4001 | width = width + 1 | |
4002 | label.Size = UDim2.new(0, width, 0, height) | |
4003 | until label.TextFits | |
4004 | end | |
4005 | local blockLabel = label:Clone() | |
4006 | blockLabel.Position = UDim2.new(0, 0, 0, totalHeight) | |
4007 | blockLabel.Size = UDim2.new(1, 0, 0, height) | |
4008 | blockLabel.Parent = frame | |
4009 | label:Destroy() | |
4010 | frame.Size = UDim2.new(0, width, 0, totalHeight + height) | |
4011 | return frame | |
4012 | end | |
4013 | end | |
4014 | end | |
4015 | function GuiServiceClass:Destroy() | |
4016 | self.running = false | |
4017 | self.cameraPart:Destroy() | |
4018 | self.cameraConnection:disconnect() | |
4019 | self.keyDownConnection:disconnect() | |
4020 | self.mouseButton1DownConnection:disconnect() | |
4021 | self.mouseButton1UpConnection:disconnect() | |
4022 | self.mouseButton2DownConnection:disconnect() | |
4023 | self.mouseButton2UpConnection:disconnect() | |
4024 | self.mouseMoveConnection:disconnect() | |
4025 | self.steppedConnection:disconnect() | |
4026 | end | |
4027 | function GuiServiceClass:GetMousePosition() | |
4028 | local mouse = self.mouse | |
4029 | return mouse.X, mouse.Y -- mouse.X, mouse.Y + 2 -- return mouse.X - 2, mouse.Y - 3 | |
4030 | end | |
4031 | function GuiServiceClass:GetTextBounds(text, font, fontSize, alignX, alignY, width) | |
4032 | local tempLabel = self.tempLabel | |
4033 | tempLabel.Font = font | |
4034 | tempLabel.FontSize = fontSize | |
4035 | tempLabel.Size = UDim2.new(0, width, 0, 4096) | |
4036 | tempLabel.Text = text | |
4037 | tempLabel.TextXAlignment = alignX | |
4038 | tempLabel.TextYAlignment = alignY | |
4039 | local textBounds = tempLabel.TextBounds | |
4040 | tempLabel.Text = "" | |
4041 | return textBounds | |
4042 | end | |
4043 | function GuiServiceClass:Init(data) | |
4044 | GuiBase.Init(self) | |
4045 | local _ = string.char | |
4046 | local camera = data.Camera | |
4047 | local mouse = data.Mouse | |
4048 | local cameraPart = Instance.new("Part") | |
4049 | local billboardGui = Instance.new("BillboardGui", cameraPart) | |
4050 | guiFrame = Instance.new("Frame", billboardGui) | |
4051 | cameraPart.Anchored = true | |
4052 | cameraPart.BottomSurface = "Smooth" | |
4053 | cameraPart.CanCollide = false | |
4054 | -- cameraPart.CFrame = CFrame.new(16384, 16384, 16384) | |
4055 | cameraPart.FormFactor = "Custom" | |
4056 | cameraPart.Locked = true | |
4057 | cameraPart.Size = Vector3.new(0.2, 0.2, 0.2) | |
4058 | cameraPart.TopSurface = "Smooth" | |
4059 | cameraPart.Transparency = 1 | |
4060 | billboardGui.Adornee = cameraPart | |
4061 | billboardGui.AlwaysOnTop = true | |
4062 | -- billboardGui.ExtentsOffset = Vector3.new(-16384, -16384, -16384) | |
4063 | guiFrame.BackgroundTransparency = 1 | |
4064 | cameraPart.Parent = camera | |
4065 | self.running = true | |
4066 | self.m_base_instance = guiFrame | |
4067 | self.billboardGui = billboardGui | |
4068 | self.cameraPart = cameraPart | |
4069 | self.tempLabel = RBXInstance.new "TextLabel" { | |
4070 | BackgroundTransparency = 1, | |
4071 | TextTransparency = 1, | |
4072 | TextWrapped = true, | |
4073 | Parent = guiFrame | |
4074 | } | |
4075 | self.mnemonics = {} | |
4076 | self.visible = true | |
4077 | self.camera = camera | |
4078 | self.mouse = mouse | |
4079 | self.cameraConnection = camera.Changed:connect(function(property) | |
4080 | self:UpdateView() | |
4081 | if property == "CameraType" then | |
4082 | if camera.CameraType ~= Enum.CameraType.Track and camera.CameraType ~= Enum.CameraType.Fixed then | |
4083 | camera.CameraType = Enum.CameraType.Track | |
4084 | end | |
4085 | elseif property == "CoordinateFrame" and camera.CameraType ~= Enum.CameraType.Fixed then | |
4086 | local cframe, focus = camera.CoordinateFrame, camera.Focus | |
4087 | local watchOffset = focus.p - cframe.p | |
4088 | local error = watchOffset.unit - cframe.lookVector | |
4089 | if error.magnitude >= 1e-3 then | |
4090 | local head = PlayerControl.GetHead() | |
4091 | local time1, velocity1 | |
4092 | if head then | |
4093 | time1 = time() | |
4094 | velocity1 = head.Velocity | |
4095 | end | |
4096 | if camera.Changed:wait() == "CoordinateFrame" then | |
4097 | local position = cframe.p | |
4098 | if head then | |
4099 | local time2 = time() | |
4100 | local velocity2 = head.Velocity | |
4101 | position = position + 0.5 * (velocity1 + velocity2) * (time2 - time1) | |
4102 | end | |
4103 | camera.CoordinateFrame = CFrame.new(position, camera.Focus.p) | |
4104 | end | |
4105 | end | |
4106 | end | |
4107 | end) | |
4108 | self.keyDownConnection = mouse.KeyDown:connect(function(key) self:KeyDown(key) end) | |
4109 | self.mouseButton1DownConnection = mouse.Button1Down:connect(function() self:MouseButton1Down() end) | |
4110 | self.mouseButton1UpConnection = mouse.Button1Up:connect(function() self:MouseButton1Up() end) | |
4111 | self.mouseButton2DownConnection = mouse.Button2Down:connect(function() self:MouseButton2Down() end) | |
4112 | self.mouseButton2UpConnection = mouse.Button2Up:connect(function() self:MouseButton2Up() end) | |
4113 | self.mouseMoveConnection = mouse.Move:connect(function() self:MouseMove() end) | |
4114 | self.steppedConnection = RunService.RenderStepped:connect(function() self:UpdateObjects() self:UpdateView() end) | |
4115 | self.mousePreviousPosition = Vector2.new(self:GetMousePosition()) | |
4116 | end | |
4117 | function GuiServiceClass:IsA(className) | |
4118 | return className == "GuiService" or GuiBase.IsA(self, className) | |
4119 | end | |
4120 | function GuiServiceClass:KeyDown(key) | |
4121 | local mnemonicButton = self.mnemonics[string.upper(key)] | |
4122 | if mnemonicButton then | |
4123 | mnemonicButton.Activated:fire() | |
4124 | end | |
4125 | end | |
4126 | function GuiServiceClass:MouseButton1Down() | |
4127 | local mouse = self.mouse | |
4128 | local mouseX, mouseY = self:GetMousePosition() | |
4129 | local stack = {self} | |
4130 | local dragObjects = {} | |
4131 | self.dragObjects = dragObjects | |
4132 | while #stack > 0 do | |
4133 | local object = stack[#stack] | |
4134 | stack[#stack] = nil | |
4135 | if object.visible then | |
4136 | for child in pairs(object.children) do | |
4137 | stack[#stack + 1] = child | |
4138 | end | |
4139 | if object.active then | |
4140 | local position = object:GetAbsolutePosition() | |
4141 | local size = object:GetAbsoluteSize() | |
4142 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
4143 | object.mouseDown = true | |
4144 | dragObjects[object] = true | |
4145 | local mouseButton1Down = object.MouseButton1Down | |
4146 | if mouseButton1Down then | |
4147 | mouseButton1Down:fire() | |
4148 | if object.autoButtonColor then | |
4149 | local color = object.color | |
4150 | local transparency = object.backgroundTransparency | |
4151 | object.m_base_instance.BackgroundColor3 = Color3.new(math.min(color.r + 0.3, 1), math.min(color.g + | |
4152 | ||
4153 | 0.3, 1), math.min(color.b + 0.3, 1)) | |
4154 | object.m_base_instance.BackgroundTransparency = transparency | |
4155 | end | |
4156 | end | |
4157 | object.DragBegin:fire() | |
4158 | end | |
4159 | end | |
4160 | end | |
4161 | end | |
4162 | self.mousePreviousPosition = Vector2.new(mouseX, mouseY) | |
4163 | end | |
4164 | function GuiServiceClass:MouseButton1Up() | |
4165 | local mouse = self.mouse | |
4166 | local mouseX, mouseY = self:GetMousePosition() | |
4167 | local stack = {self} | |
4168 | while #stack > 0 do | |
4169 | local object = stack[#stack] | |
4170 | stack[#stack] = nil | |
4171 | if object.visible then | |
4172 | for child in pairs(object.children) do | |
4173 | stack[#stack + 1] = child | |
4174 | end | |
4175 | if object.active then | |
4176 | local position = object:GetAbsolutePosition() | |
4177 | local size = object:GetAbsoluteSize() | |
4178 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
4179 | object.MouseButton1Up:fire() | |
4180 | end | |
4181 | end | |
4182 | end | |
4183 | end | |
4184 | local dragObjects = self.dragObjects | |
4185 | self.dragObjects = nil | |
4186 | if dragObjects then | |
4187 | for dragObject in pairs(dragObjects) do | |
4188 | dragObject.mouseDown = false | |
4189 | local position = dragObject:GetAbsolutePosition() | |
4190 | local size = dragObject:GetAbsoluteSize() | |
4191 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
4192 | dragObject.MouseButton1Click:fire() | |
4193 | local activated = dragObject.Activated | |
4194 | if activated then | |
4195 | activated:fire() | |
4196 | end | |
4197 | end | |
4198 | dragObject.DragStopped:fire() | |
4199 | if dragObject.autoButtonColor then | |
4200 | if dragObject.mouseOver then | |
4201 | local color = dragObject.color | |
4202 | local transparency = dragObject.backgroundTransparency | |
4203 | dragObject.m_base_instance.BackgroundColor3 = Color3.new(math.max(color.r - 0.3, 0), math.max(color.g - 0.3, 0), | |
4204 | ||
4205 | math.max(color.b - 0.3, 0)) | |
4206 | dragObject.m_base_instance.BackgroundTransparency = math.max(0, transparency - 0.2) | |
4207 | else | |
4208 | dragObject.m_base_instance.BackgroundColor3 = dragObject.color | |
4209 | dragObject.m_base_instance.BackgroundTransparency = dragObject.backgroundTransparency | |
4210 | end | |
4211 | end | |
4212 | self.dragObject = nil | |
4213 | end | |
4214 | end | |
4215 | end | |
4216 | function GuiServiceClass:MouseButton2Down() | |
4217 | local mouse = self.mouse | |
4218 | local mouseX, mouseY = self:GetMousePosition() | |
4219 | local stack = {self} | |
4220 | while #stack > 0 do | |
4221 | local object = stack[#stack] | |
4222 | stack[#stack] = nil | |
4223 | if object.visible then | |
4224 | for child in pairs(object.children) do | |
4225 | stack[#stack + 1] = child | |
4226 | end | |
4227 | if object.active then | |
4228 | local position = object:GetAbsolutePosition() | |
4229 | local size = object:GetAbsoluteSize() | |
4230 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
4231 | local mouseButton2Down = object.MouseButton2Down | |
4232 | if mouseButton2Down then | |
4233 | mouseButton2Down:fire() | |
4234 | end | |
4235 | end | |
4236 | end | |
4237 | end | |
4238 | end | |
4239 | self.mousePreviousPosition = Vector2.new(mouseX, mouseY) | |
4240 | end | |
4241 | function GuiServiceClass:MouseButton2Up() | |
4242 | local mouse = self.mouse | |
4243 | local mouseX, mouseY = self:GetMousePosition() | |
4244 | local stack = {self} | |
4245 | while #stack > 0 do | |
4246 | local object = stack[#stack] | |
4247 | stack[#stack] = nil | |
4248 | if object.visible then | |
4249 | for child in pairs(object.children) do | |
4250 | stack[#stack + 1] = child | |
4251 | end | |
4252 | if object.active then | |
4253 | local position = object:GetAbsolutePosition() | |
4254 | local size = object:GetAbsoluteSize() | |
4255 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
4256 | local mouseButton2Up = object.MouseButton2Up | |
4257 | if mouseButton2Up then | |
4258 | mouseButton2Up:fire() | |
4259 | end | |
4260 | end | |
4261 | end | |
4262 | end | |
4263 | end | |
4264 | end | |
4265 | function GuiServiceClass:MouseMove() | |
4266 | self:UpdateObjects() | |
4267 | local dragObjects = self.dragObjects | |
4268 | if dragObjects then | |
4269 | for dragObject in pairs(dragObjects) do | |
4270 | local mouse = self.mouse | |
4271 | local mousePosition = Vector2.new(self:GetMousePosition()) | |
4272 | dragObject.DragMove:fire(mousePosition - self.mousePreviousPosition) | |
4273 | self.mousePreviousPosition = mousePosition | |
4274 | end | |
4275 | end | |
4276 | end | |
4277 | function GuiServiceClass:SetMnemonic(mnemonic, button) | |
4278 | self.mnemonics[mnemonic] = button | |
4279 | end | |
4280 | function GuiServiceClass:UpdateObjects() | |
4281 | local mouse = self.mouse | |
4282 | local mouseX, mouseY = self:GetMousePosition() | |
4283 | local stack = {self} | |
4284 | while #stack > 0 do | |
4285 | local object = stack[#stack] | |
4286 | stack[#stack] = nil | |
4287 | if object.visible then | |
4288 | for child in pairs(object.children) do | |
4289 | stack[#stack + 1] = child | |
4290 | end | |
4291 | if object.active then | |
4292 | local position = object:GetAbsolutePosition() | |
4293 | local size = object:GetAbsoluteSize() | |
4294 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
4295 | if not object.mouseOver then | |
4296 | object.mouseOver = true | |
4297 | object.MouseEnter:fire() | |
4298 | if object.autoButtonColor then | |
4299 | local color = object.color | |
4300 | local transparency = object.backgroundTransparency | |
4301 | if object.mouseDown then | |
4302 | object.m_base_instance.BackgroundColor3 = Color3.new(math.min(color.r + 0.3, 1), math.min(color.g + 0.3, 1), math.min(color.b + 0.3, 1)) | |
4303 | object.m_base_instance.BackgroundTransparency = transparency | |
4304 | else | |
4305 | object.m_base_instance.BackgroundColor3 = Color3.new(math.max(color.r - 0.3, 0), math.max(color.g - 0.3, 0), math.max(color.b - 0.3, 0)) | |
4306 | object.m_base_instance.BackgroundTransparency = math.max(0, transparency - 0.2) | |
4307 | end | |
4308 | end | |
4309 | end | |
4310 | else | |
4311 | if object.mouseOver then | |
4312 | object.mouseOver = false | |
4313 | object.MouseLeave:fire() | |
4314 | if object.autoButtonColor then | |
4315 | object.m_base_instance.BackgroundColor3 = object.color | |
4316 | object.m_base_instance.BackgroundTransparency = object.backgroundTransparency | |
4317 | end | |
4318 | end | |
4319 | end | |
4320 | end | |
4321 | end | |
4322 | end | |
4323 | end | |
4324 | function GuiServiceClass:UpdateView() | |
4325 | local billboardGui = self.billboardGui | |
4326 | local guiFrame = self.m_base_instance | |
4327 | local camera = self.camera | |
4328 | local mouse = self.mouse | |
4329 | local cameraCFrame = CFrame.new(camera.CoordinateFrame.p, camera.Focus.p) -- camera.CoordinateFrame | |
4330 | local viewSizeX, viewSizeY = mouse.ViewSizeX, mouse.ViewSizeY | |
4331 | local previousViewSize = self.viewSize | |
4332 | if not previousViewSize or ((viewSizeX ~= 0 or viewSizeY ~= 0) and (viewSizeX ~= previousViewSize.X or viewSizeY ~= previousViewSize.Y)) then | |
4333 | self.viewSize = {X = viewSizeX, Y = viewSizeY} | |
4334 | local viewSizeUDim2 = UDim2.new(0, viewSizeX, 0, viewSizeY) | |
4335 | billboardGui.Size = viewSizeUDim2 | |
4336 | guiFrame.Size = viewSizeUDim2 | |
4337 | -- FIXME: | |
4338 | -- After the 15th of July 2014, there came an offset at the Y thingy out of nowhere so I accomodated for that. | |
4339 | billboardGui.SizeOffset = Vector2.new(0.5 / viewSizeX, (0.5 + 10) / viewSizeY) | |
4340 | end | |
4341 | --billboardGui.SizeOffset = Vector2.new() | |
4342 | billboardGui.StudsOffset = (cameraCFrame - cameraCFrame.p):inverse() * cameraCFrame.p - Vector3.new(0, 0, 1) | |
4343 | end | |
4344 | GuiService = GuiServiceClass:new { | |
4345 | Camera = Camera, | |
4346 | Mouse = Mouse | |
4347 | } | |
4348 | GuiFrame = setmetatable({}, GuiObject) | |
4349 | GuiFrame.__index = GuiFrame | |
4350 | GuiFrame.__default = {__index = { | |
4351 | Active = false, | |
4352 | BackgroundTransparency = 0.75, | |
4353 | BorderSize = 4, | |
4354 | BorderTransparency = 0.75, | |
4355 | Color = AdvancedGUI.GUI_BASE_COLOR, | |
4356 | Position = UDim2.new(0, 0, 0, 0), | |
4357 | Size = UDim2.new(0, 52, 0, 52), | |
4358 | Visible = true | |
4359 | }} | |
4360 | function GuiFrame:Destroy() | |
4361 | GuiObject.Destroy(self) | |
4362 | end | |
4363 | function GuiFrame:GetContentInstance() | |
4364 | return self.m_content_frame | |
4365 | end | |
4366 | function GuiFrame:Init(data) | |
4367 | GuiObject.Init(self) | |
4368 | setmetatable(data, GuiFrame.__default) | |
4369 | local leftBorderFrameLeft = RBXInstance.new "Frame" { | |
4370 | BackgroundColor3 = Color3.new(0, 0, 0), | |
4371 | BorderSizePixel = 0, | |
4372 | Size = UDim2.new(0, 1, 1, -1) | |
4373 | } | |
4374 | local leftBorderFrameCenter = RBXInstance.new "Frame" { | |
4375 | BackgroundColor3 = Color3.new(1, 1, 1), | |
4376 | BorderSizePixel = 0, | |
4377 | Position = UDim2.new(0, 1, 0, 1) | |
4378 | } | |
4379 | local leftBorderFrameRight = RBXInstance.new "Frame" { | |
4380 | BackgroundColor3 = Color3.new(0, 0, 0), | |
4381 | BorderSizePixel = 0 | |
4382 | } | |
4383 | local rightBorderFrameRight = RBXInstance.new "Frame" { | |
4384 | BackgroundColor3 = Color3.new(0, 0, 0), | |
4385 | BorderSizePixel = 0, | |
4386 | Position = UDim2.new(1, -1, 0, 1), | |
4387 | Size = UDim2.new(0, 1, 1, -1) | |
4388 | } | |
4389 | local rightBorderFrameCenter = RBXInstance.new "Frame" { | |
4390 | BackgroundColor3 = Color3.new(1, 1, 1), | |
4391 | BorderSizePixel = 0 | |
4392 | } | |
4393 | local rightBorderFrameLeft = RBXInstance.new "Frame" { | |
4394 | BackgroundColor3 = Color3.new(0, 0, 0), | |
4395 | BorderSizePixel = 0 | |
4396 | } | |
4397 | local bottomBorderFrameBottom = RBXInstance.new "Frame" { | |
4398 | BackgroundColor3 = Color3.new(0, 0, 0), | |
4399 | BorderSizePixel = 0, | |
4400 | Position = UDim2.new(0, 0, 1, -1), | |
4401 | Size = UDim2.new(1, -1, 0, 1) | |
4402 | } | |
4403 | local bottomBorderFrameCenter = RBXInstance.new "Frame" { | |
4404 | BackgroundColor3 = Color3.new(1, 1, 1), | |
4405 | BorderSizePixel = 0 | |
4406 | } | |
4407 | local bottomBorderFrameTop = RBXInstance.new "Frame" { | |
4408 | BackgroundColor3 = Color3.new(0, 0, 0), | |
4409 | BorderSizePixel = 0 | |
4410 | } | |
4411 | local topBorderFrameTop = RBXInstance.new "Frame" { | |
4412 | BackgroundColor3 = Color3.new(0, 0, 0), | |
4413 | BorderSizePixel = 0, | |
4414 | Position = UDim2.new(0, 1, 0, 0), | |
4415 | Size = UDim2.new(1, -1, 0, 1) | |
4416 | } | |
4417 | local topBorderFrameCenter = RBXInstance.new "Frame" { | |
4418 | BackgroundColor3 = Color3.new(1, 1, 1), | |
4419 | BorderSizePixel = 0 | |
4420 | } | |
4421 | local topBorderFrameBottom = RBXInstance.new "Frame" { | |
4422 | BackgroundColor3 = Color3.new(0, 0, 0), | |
4423 | BorderSizePixel = 0 | |
4424 | } | |
4425 | local border_frame = RBXInstance.new "Frame" { | |
4426 | BackgroundTransparency = 1, | |
4427 | Size = UDim2.new(1, 0, 1, 0), | |
4428 | leftBorderFrameLeft, | |
4429 | leftBorderFrameCenter, | |
4430 | leftBorderFrameRight, | |
4431 | rightBorderFrameLeft, | |
4432 | rightBorderFrameCenter, | |
4433 | rightBorderFrameRight, | |
4434 | bottomBorderFrameBottom, | |
4435 | bottomBorderFrameCenter, | |
4436 | bottomBorderFrameTop, | |
4437 | topBorderFrameBottom, | |
4438 | topBorderFrameCenter, | |
4439 | topBorderFrameTop | |
4440 | } | |
4441 | local contentFrame = RBXInstance.new "Frame" { | |
4442 | BackgroundTransparency = 1, | |
4443 | BorderSizePixel = 0, | |
4444 | ClipsDescendants = true, | |
4445 | Size = UDim2.new(1, 0, 1, 0) | |
4446 | } | |
4447 | local base_frame = RBXInstance.new "Frame" { | |
4448 | BorderSizePixel = 0, | |
4449 | border_frame, | |
4450 | contentFrame | |
4451 | } | |
4452 | self.m_base_instance = base_frame | |
4453 | self.m_content_frame = contentFrame | |
4454 | self.m_border_frame = border_frame | |
4455 | self.leftBorderFrameLeft = leftBorderFrameLeft | |
4456 | self.leftBorderFrameCenter = leftBorderFrameCenter | |
4457 | self.leftBorderFrameRight = leftBorderFrameRight | |
4458 | self.rightBorderFrameLeft = rightBorderFrameLeft | |
4459 | self.rightBorderFrameCenter = rightBorderFrameCenter | |
4460 | self.rightBorderFrameRight = rightBorderFrameRight | |
4461 | self.bottomBorderFrameBottom = bottomBorderFrameBottom | |
4462 | self.bottomBorderFrameCenter = bottomBorderFrameCenter | |
4463 | self.bottomBorderFrameTop = bottomBorderFrameTop | |
4464 | self.topBorderFrameBottom = topBorderFrameBottom | |
4465 | self.topBorderFrameCenter = topBorderFrameCenter | |
4466 | self.topBorderFrameTop = topBorderFrameTop | |
4467 | self:SetActive(data.Active) | |
4468 | self:SetBackgroundTransparency(data.BackgroundTransparency) | |
4469 | self:SetBorderSize(data.BorderSize) | |
4470 | self:SetBorderTransparency(data.BorderTransparency) | |
4471 | self:SetColor(data.Color) | |
4472 | self:SetPosition(data.Position) | |
4473 | self:SetSize(data.Size) | |
4474 | self:SetVisible(data.Visible) | |
4475 | self:SetParent(data.Parent) | |
4476 | end | |
4477 | function GuiFrame:IsA(className) | |
4478 | return className == "GuiFrame" or GuiObject.IsA(self, className) | |
4479 | end | |
4480 | function GuiFrame:SetBorderSize(border_size) | |
4481 | border_size = math.max(math.floor(border_size + 0.5), 0) | |
4482 | if border_size ~= self.m_border_size then | |
4483 | self.m_border_size = border_size | |
4484 | local border_frame = self.m_border_frame | |
4485 | local contentFrame = self.m_content_frame | |
4486 | local leftBorderFrameCenter = self.leftBorderFrameCenter | |
4487 | local leftBorderFrameRight = self.leftBorderFrameRight | |
4488 | local rightBorderFrameCenter = self.rightBorderFrameCenter | |
4489 | local rightBorderFrameLeft = self.rightBorderFrameLeft | |
4490 | local bottomBorderFrameCenter = self.bottomBorderFrameCenter | |
4491 | local bottomBorderFrameTop = self.bottomBorderFrameTop | |
4492 | local topBorderFrameCenter = self.topBorderFrameCenter | |
4493 | local topBorderFrameBottom = self.topBorderFrameBottom | |
4494 | contentFrame.Position = UDim2.new(0, border_size, 0, border_size) | |
4495 | contentFrame.Size = UDim2.new(1, -2 * border_size, 1, -2 * border_size) | |
4496 | local inner_visible = border_size > 0 | |
4497 | if self.leftBorderFrameLeft.Visible ~= inner_visible then | |
4498 | self.rightBorderFrameRight.Visible = inner_visible | |
4499 | self.bottomBorderFrameBottom.Visible = inner_visible | |
4500 | self.topBorderFrameTop.Visible = inner_visible | |
4501 | end | |
4502 | local outer_visible = border_size > 1 | |
4503 | if leftBorderFrameCenter.Visible ~= outer_visible then | |
4504 | leftBorderFrameCenter.Visible = outer_visible | |
4505 | leftBorderFrameRight.Visible = outer_visible | |
4506 | rightBorderFrameCenter.Visible = outer_visible | |
4507 | rightBorderFrameLeft.Visible = outer_visible | |
4508 | bottomBorderFrameCenter.Visible = outer_visible | |
4509 | bottomBorderFrameTop.Visible = outer_visible | |
4510 | topBorderFrameCenter.Visible = outer_visible | |
4511 | topBorderFrameBottom.Visible = outer_visible | |
4512 | end | |
4513 | if outer_visible then | |
4514 | leftBorderFrameCenter.Size = UDim2.new(0, border_size - 2, 1, -border_size) | |
4515 | leftBorderFrameRight.Position = UDim2.new(0, border_size - 1, 0, border_size - 1) | |
4516 | leftBorderFrameRight.Size = UDim2.new(0, 1, 1, 1 - 2 * border_size) | |
4517 | rightBorderFrameCenter.Position = UDim2.new(1, 1 - border_size, 0, border_size - 1) | |
4518 | rightBorderFrameCenter.Size = UDim2.new(0, border_size - 2, 1, -border_size) | |
4519 | rightBorderFrameLeft.Position = UDim2.new(1, -border_size, 0, border_size) | |
4520 | rightBorderFrameLeft.Size = UDim2.new(0, 1, 1, 1 - 2 * border_size) | |
4521 | bottomBorderFrameCenter.Position = UDim2.new(0, 1, 1, 1 - border_size) | |
4522 | bottomBorderFrameCenter.Size = UDim2.new(1, -border_size, 0, border_size - 2) | |
4523 | bottomBorderFrameTop.Position = UDim2.new(0, border_size - 1, 1, -border_size) | |
4524 | bottomBorderFrameTop.Size = UDim2.new(1, 1 - 2 * border_size, 0, 1) | |
4525 | topBorderFrameCenter.Position = UDim2.new(0, border_size - 1, 0, 1) | |
4526 | topBorderFrameCenter.Size = UDim2.new(1, -border_size, 0, border_size - 2) | |
4527 | topBorderFrameBottom.Position = UDim2.new(0, border_size, 0, border_size - 1) | |
4528 | topBorderFrameBottom.Size = UDim2.new(1, 1 - 2 * border_size, 0, 1) | |
4529 | end | |
4530 | end | |
4531 | end | |
4532 | function GuiFrame:SetBorderTransparency(borderTransparency) | |
4533 | self.borderTransparency = borderTransparency | |
4534 | self.leftBorderFrameLeft.BackgroundTransparency = borderTransparency | |
4535 | self.leftBorderFrameCenter.BackgroundTransparency = borderTransparency | |
4536 | self.leftBorderFrameRight.BackgroundTransparency = borderTransparency | |
4537 | self.rightBorderFrameLeft.BackgroundTransparency = borderTransparency | |
4538 | self.rightBorderFrameCenter.BackgroundTransparency = borderTransparency | |
4539 | self.rightBorderFrameRight.BackgroundTransparency = borderTransparency | |
4540 | self.bottomBorderFrameBottom.BackgroundTransparency = borderTransparency | |
4541 | self.bottomBorderFrameCenter.BackgroundTransparency = borderTransparency | |
4542 | self.bottomBorderFrameTop.BackgroundTransparency = borderTransparency | |
4543 | self.topBorderFrameBottom.BackgroundTransparency = borderTransparency | |
4544 | self.topBorderFrameCenter.BackgroundTransparency = borderTransparency | |
4545 | self.topBorderFrameTop.BackgroundTransparency = borderTransparency | |
4546 | end | |
4547 | GuiButton = setmetatable({}, GuiFrame) | |
4548 | GuiButton.__index = GuiButton | |
4549 | GuiButton.__default = {__index = { | |
4550 | AutoButtonColor = true | |
4551 | }} | |
4552 | function GuiButton:Destroy() | |
4553 | self.Activated:disconnect() | |
4554 | GuiFrame.Destroy(self) | |
4555 | end | |
4556 | function GuiButton:Init(data) | |
4557 | if data.Active == nil then | |
4558 | data.Active = true | |
4559 | end | |
4560 | GuiFrame.Init(self, data) | |
4561 | setmetatable(data, GuiButton.__default) | |
4562 | self.Activated = RbxUtility.CreateSignal() | |
4563 | self:SetAutoButtonColor(data.AutoButtonColor) | |
4564 | end | |
4565 | function GuiButton:IsA(className) | |
4566 | return className == "GuiButton" or GuiFrame.IsA(self, className) | |
4567 | end | |
4568 | function GuiButton:SetAutoButtonColor(autoButtonColor) | |
4569 | if autoButtonColor ~= self.autoButtonColor then | |
4570 | self.autoButtonColor = autoButtonColor | |
4571 | if autoButtonColor then | |
4572 | if self.mouseOver then | |
4573 | local color = self.color | |
4574 | local transparency = self.backgroundTransparency | |
4575 | if self.mouseDown then | |
4576 | self.m_base_instance.BackgroundColor3 = Color3.new(math.min(color.r + 0.3, 1), math.min(color.g + 0.3, 1), math.min(color.b + 0.3, 1)) | |
4577 | self.m_base_instance.BackgroundTransparency = transparency | |
4578 | else | |
4579 | self.m_base_instance.BackgroundColor3 = Color3.new(math.max(color.r - 0.3, 0), math.max(color.g - 0.3, 0), math.max(color.b - 0.3, 0)) | |
4580 | self.m_base_instance.BackgroundTransparency = math.max(0, transparency - 0.5) | |
4581 | end | |
4582 | end | |
4583 | else | |
4584 | self.m_base_instance.BackgroundColor3 = self.color | |
4585 | end | |
4586 | end | |
4587 | end | |
4588 | GuiTextLabel = setmetatable({}, GuiFrame) | |
4589 | GuiTextLabel.__index = GuiTextLabel | |
4590 | GuiTextLabel.__default = {__index = { | |
4591 | Font = "ArialBold", | |
4592 | FontSize = "Size12", | |
4593 | Text = "", | |
4594 | TextColor = Color3.new(1, 1, 1), | |
4595 | TextStrokeColor = Color3.new(0, 0, 0), | |
4596 | TextStrokeTransparency = 0.6, | |
4597 | TextWrapped = true | |
4598 | }} | |
4599 | function GuiTextLabel:Destroy() | |
4600 | GuiFrame.Destroy(self) | |
4601 | end | |
4602 | function GuiTextLabel:Init(data) | |
4603 | GuiFrame.Init(self, data) | |
4604 | setmetatable(data, GuiTextLabel.__default) | |
4605 | local base_instance = self.m_base_instance | |
4606 | local textLabel = RBXInstance.new "TextLabel" { | |
4607 | BackgroundTransparency = 1, | |
4608 | Font = data.Font, | |
4609 | FontSize = data.FontSize, | |
4610 | TextColor3 = data.TextColor3, | |
4611 | TextStrokeColor3 = data.TextStrokeColor3, | |
4612 | TextStrokeTransparency = data.TextStrokeTransparency, | |
4613 | TextWrapped = data.TextWrapped | |
4614 | } | |
4615 | textLabel.Parent = self:GetContentInstance() | |
4616 | self.textLabel = textLabel | |
4617 | self:SetText(data.Text) | |
4618 | end | |
4619 | function GuiTextLabel:IsA(className) | |
4620 | return className == "GuiTextLabel" or GuiFrame.IsA(self, className) | |
4621 | end | |
4622 | function GuiTextLabel:SetText(text) | |
4623 | if text ~= self.text then | |
4624 | self.text = text | |
4625 | local text_index = 1 | |
4626 | local content_instance = self:GetContentInstance() | |
4627 | local content_instance_size = content_instance.AbsoluteSize | |
4628 | local frame = Instance.new("Frame") | |
4629 | frame.BackgroundTransparency = 1 | |
4630 | local label = Instance.new("TextLabel") | |
4631 | label.BackgroundTransparency = 1 | |
4632 | label.Font = font | |
4633 | label.FontSize = fontSize | |
4634 | label.Size = UDim2.new(0, content_instance_size.X, 0, 1000) | |
4635 | label.Text = "" | |
4636 | label.TextColor3 = textColor3 | |
4637 | label.TextTransparency = 1 | |
4638 | label.TextWrapped = true | |
4639 | label.TextXAlignment = textXAlignment | |
4640 | label.TextYAlignment = textYAlignment | |
4641 | label.Parent = self.guiFrame | |
4642 | local row_length = 0 | |
4643 | local step_size = 256 | |
4644 | for step = 1, 8 do | |
4645 | step_size = 0.5 * step_size | |
4646 | label.Text = string.sub(text, text_index, text_index + row_length - 1) | |
4647 | end | |
4648 | end | |
4649 | end | |
4650 | GuiImageButton = setmetatable({}, GuiButton) | |
4651 | GuiImageButton.__index = GuiImageButton | |
4652 | GuiImageButton.__default = {__index = { | |
4653 | Image = "" | |
4654 | }} | |
4655 | function GuiImageButton:Destroy() | |
4656 | GuiButton.Destroy(self) | |
4657 | end | |
4658 | function GuiImageButton:Init(data) | |
4659 | GuiButton.Init(self, data) | |
4660 | setmetatable(data, GuiImageButton.__default) | |
4661 | local content_frame = self.m_content_frame | |
4662 | local image_label = RBXInstance.new "ImageLabel" { | |
4663 | BackgroundTransparency = 1, | |
4664 | Size = UDim2.new(1, 0, 1, 0) | |
4665 | } | |
4666 | image_label.Parent = content_frame | |
4667 | self.m_image_label = image_label | |
4668 | self:SetImage(data.Image) | |
4669 | end | |
4670 | function GuiImageButton:IsA(className) | |
4671 | return className == "GuiImageButton" or GuiButton.IsA(self, className) | |
4672 | end | |
4673 | function GuiImageButton:SetImage(image) | |
4674 | if image ~= self.m_image then | |
4675 | self.m_image = image | |
4676 | self.m_image_label.Image = image | |
4677 | end | |
4678 | end | |
4679 | GuiTextButton = setmetatable({}, GuiButton) | |
4680 | GuiTextButton.__index = GuiTextButton | |
4681 | GuiTextButton.__default = {__index = { | |
4682 | Font = Enum.Font.ArialBold, | |
4683 | FontSize = Enum.FontSize.Size11, | |
4684 | Text = "Button", | |
4685 | TextXAlignment = Enum.TextXAlignment.Center | |
4686 | }} | |
4687 | function GuiTextButton:Destroy() | |
4688 | GuiButton.Destroy(self) | |
4689 | end | |
4690 | function GuiTextButton:GetTextBounds() | |
4691 | return self.textLabel.TextBounds | |
4692 | end | |
4693 | function GuiTextButton:Init(data) | |
4694 | GuiButton.Init(self, data) | |
4695 | setmetatable(data, GuiTextButton.__default) | |
4696 | local contentFrame = self.m_content_frame | |
4697 | local mnemonicLabel = RBXInstance.new "TextLabel" { | |
4698 | BackgroundTransparency = 1, | |
4699 | Font = "ArialBold", | |
4700 | FontSize = "Size36", | |
4701 | Size = UDim2.new(1, 0, 0.7, 0), | |
4702 | TextColor3 = Color3.new(1, 1, 1), | |
4703 | TextStrokeColor3 = Color3.new(0, 0, 0), | |
4704 | TextStrokeTransparency = 0.6, | |
4705 | TextWrapped = true | |
4706 | } | |
4707 | local textLabel = RBXInstance.new "TextLabel" { | |
4708 | BackgroundTransparency = 1, | |
4709 | TextColor3 = Color3.new(1, 1, 1), | |
4710 | TextStrokeColor3 = Color3.new(0, 0, 0), | |
4711 | TextStrokeTransparency = 0.6, | |
4712 | TextWrapped = true | |
4713 | } | |
4714 | mnemonicLabel.Parent = contentFrame | |
4715 | textLabel.Parent = contentFrame | |
4716 | self.mnemonicLabel = mnemonicLabel | |
4717 | self.textLabel = textLabel | |
4718 | self:SetFont(data.Font) | |
4719 | self:SetFontSize(data.FontSize) | |
4720 | self:SetMnemonic(data.Mnemonic, true) | |
4721 | self:SetText(data.Text) | |
4722 | self:SetTextXAlignment(data.TextXAlignment) | |
4723 | end | |
4724 | function GuiTextButton:IsA(className) | |
4725 | return className == "GuiTextButton" or GuiButton.IsA(self, className) | |
4726 | end | |
4727 | function GuiTextButton:SetFont(font) | |
4728 | if font ~= self.font then | |
4729 | self.font = font | |
4730 | self.textLabel.Font = font | |
4731 | end | |
4732 | end | |
4733 | function GuiTextButton:SetFontSize(fontSize) | |
4734 | if fontSize ~= self.fontSize then | |
4735 | self.fontSize = fontSize | |
4736 | self.textLabel.FontSize = fontSize | |
4737 | end | |
4738 | end | |
4739 | function GuiTextButton:SetMnemonic(mnemonic, forceUpdate) | |
4740 | if mnemonic ~= self.mnemonic or forceUpdate then | |
4741 | if self.mnemonic then | |
4742 | GuiService:SetMnemonic(self.mnemonic, nil) | |
4743 | end | |
4744 | if mnemonic then | |
4745 | GuiService:SetMnemonic(mnemonic, self) | |
4746 | end | |
4747 | self.mnemonic = mnemonic | |
4748 | local mnemonicLabel = self.mnemonicLabel | |
4749 | local textLabel = self.textLabel | |
4750 | if mnemonic then | |
4751 | mnemonicLabel.Text = mnemonic | |
4752 | textLabel.Size = UDim2.new(1, 0, 0.9, 0) | |
4753 | textLabel.TextYAlignment = "Bottom" | |
4754 | else | |
4755 | mnemonicLabel.Text = "" | |
4756 | textLabel.Size = UDim2.new(1, 0, 1, 0) | |
4757 | textLabel.TextYAlignment = "Center" | |
4758 | end | |
4759 | end | |
4760 | end | |
4761 | function GuiTextButton:SetText(text) | |
4762 | if text ~= self.text then | |
4763 | self.text = text | |
4764 | self.textLabel.Text = text | |
4765 | end | |
4766 | end | |
4767 | function GuiTextButton:SetTextXAlignment(textXAlignment) | |
4768 | if textXAlignment ~= self.textXAlignment then | |
4769 | self.textXAlignment = textXAlignment | |
4770 | self.textLabel.TextXAlignment = textXAlignment | |
4771 | end | |
4772 | end | |
4773 | GuiWindow = setmetatable({}, GuiObject) | |
4774 | GuiWindow.__index = GuiWindow | |
4775 | GuiWindow.__default = {__index = { | |
4776 | Active = true, | |
4777 | BackgroundTransparency = 0.5, | |
4778 | BorderSize = 4, | |
4779 | BorderTransparency = 0.5, | |
4780 | Position = UDim2.new(0, 0, 0, 0), | |
4781 | Size = UDim2.new(0, 360, 0, 240), | |
4782 | Title = "Window", | |
4783 | TitleBarBackgroundTransparency = 0.5, | |
4784 | TitleBarBorderTransparency = 1, | |
4785 | Visible = true | |
4786 | }} | |
4787 | function GuiWindow:Init(data) | |
4788 | GuiObject.Init(self) | |
4789 | setmetatable(data, GuiFrame.__default) | |
4790 | local title_bar = GuiTextLabel:new { | |
4791 | BackgroundTransparency = data.TitleBarBackgroundTransparency, | |
4792 | BorderTransparency = data.TitleBarBackgroundTransparency, | |
4793 | Text = data.Title | |
4794 | } | |
4795 | local content_frame = GuiFrame:new { | |
4796 | Active = data.Active, | |
4797 | BackgroundTransparency = data.BackgroundTransparency, | |
4798 | BorderSize = data.BorderSize, | |
4799 | BorderTransparency = data.BorderTransparency | |
4800 | } | |
4801 | local base_frame = RBXInstance.new "Frame" { | |
4802 | BackgroundTransparency = 1, | |
4803 | BorderSizePixel = 0, | |
4804 | Position = data.Position, | |
4805 | Size = data.Size, | |
4806 | Visible = data.Visible | |
4807 | } | |
4808 | self.m_base_frame = base_frame | |
4809 | self.m_content_frame = content_frame | |
4810 | self.m_title_bar = title_bar | |
4811 | end | |
4812 | function GuiWindow:IsA(className) | |
4813 | return className == "GuiWindow" or GuiObject.IsA(self, className) | |
4814 | end | |
4815 | GuiScrollFrame = setmetatable({}, GuiFrame) | |
4816 | GuiScrollFrame.__index = GuiScrollFrame | |
4817 | GuiScrollFrame.__default = {__index = { | |
4818 | ContentHeight = 0, | |
4819 | ScrollBarColor = Color3.new(1, 1, 1) | |
4820 | }} | |
4821 | function GuiScrollFrame:Destroy() | |
4822 | self.m_scroll_bar:Destroy() | |
4823 | GuiFrame.Destroy(self) | |
4824 | end | |
4825 | function GuiScrollFrame:GetContentInstance() | |
4826 | return self.m_scroll_frame or GuiFrame.GetContentInstance(self) | |
4827 | end | |
4828 | function GuiScrollFrame:Init(data) | |
4829 | GuiFrame.Init(self, data) | |
4830 | setmetatable(data, GuiScrollFrame.__default) | |
4831 | local scroll_pane = RBXInstance.new "Frame" { | |
4832 | BackgroundColor3 = Color3.new(1, 1, 1), | |
4833 | BackgroundTransparency = 0.8, | |
4834 | BorderSizePixel = 0, | |
4835 | Position = UDim2.new(1, -20, 0, 0), | |
4836 | Size = UDim2.new(0, 20, 1, 0), | |
4837 | Parent = self.m_content_frame | |
4838 | } | |
4839 | local scroll_bar = GuiFrame:new { | |
4840 | Active = true, | |
4841 | BackgroundTransparency = 0.6, | |
4842 | BorderTransparency = 0.6, | |
4843 | Color = data.ScrollBarColor, | |
4844 | Parent = self | |
4845 | } | |
4846 | local scroll_frame = RBXInstance.new "Frame" { | |
4847 | BackgroundTransparency = 1, | |
4848 | Parent = self.m_content_frame | |
4849 | } | |
4850 | self.m_scroll_bar = scroll_bar | |
4851 | self.m_scroll_frame = scroll_frame | |
4852 | self.m_scroll_pane = scroll_pane | |
4853 | self.m_scroll_position = 0 | |
4854 | self.m_updating_content_height = false | |
4855 | self:SetContentHeight(data.ContentHeight) | |
4856 | self:UpdateScrollPosition() | |
4857 | self.m_scroll_bar.DragBegin:connect(function() | |
4858 | self.m_scroll_drag_total = Vector2.new() | |
4859 | self.m_scroll_initial_position = self.m_scroll_position | |
4860 | end) | |
4861 | self.m_scroll_bar.DragMove:connect(function(offset) | |
4862 | self.m_scroll_drag_total = self.m_scroll_drag_total + offset | |
4863 | local absolute_height = self:GetAbsoluteSize().Y - 2 * self.m_border_size | |
4864 | if absolute_height ~= 0 then | |
4865 | local content_height = math.max(self.m_content_height, absolute_height) | |
4866 | local scroll_space = 1 - absolute_height / content_height | |
4867 | self:Scroll(self.m_scroll_initial_position + self.m_scroll_drag_total.Y * (content_height / absolute_height - 1) / scroll_space) | |
4868 | end | |
4869 | end) | |
4870 | end | |
4871 | function GuiScrollFrame:IsA(className) | |
4872 | return className == "GuiScrollFrame" or GuiFrame.IsA(self, className) | |
4873 | end | |
4874 | function GuiScrollFrame:Scroll(position) | |
4875 | position = math.min(math.max(position, 0), self.m_content_height - (self:GetAbsoluteSize().Y - 2 * self.m_border_size)) | |
4876 | if position ~= self.m_scroll_position then | |
4877 | self.m_scroll_position = position | |
4878 | self:UpdateScrollPosition() | |
4879 | end | |
4880 | end | |
4881 | function GuiScrollFrame:SetContentHeight(height) | |
4882 | if height ~= self.m_content_height then | |
4883 | local prev_height = self.m_content_height | |
4884 | self.m_content_height = height | |
4885 | if not self.m_updating_content_height then | |
4886 | self.m_updating_content_height = true | |
4887 | coroutine.resume(coroutine.create(function() | |
4888 | local success, message = ypcall(self.SetContentHeightImpl1, self, prev_height) | |
4889 | if not success then | |
4890 | Logger.printf("Severe", "Error in GuiScrollFrame:SetContentHeight(%s): %s", Utility.ToString(height), message) | |
4891 | end | |
4892 | end)) | |
4893 | end | |
4894 | end | |
4895 | end | |
4896 | function GuiScrollFrame:SetContentHeightImpl1(prev_height) | |
4897 | RunService.RenderStepped:wait() | |
4898 | self.m_updating_content_height = false | |
4899 | local height = self.m_content_height | |
4900 | self.m_scroll_frame.Size = UDim2.new(1, -20, 0, height) | |
4901 | if prev_height and prev_height ~= 0 then | |
4902 | local absolute_height = self:GetAbsoluteSize().Y - 2 * self.m_border_size | |
4903 | if self.m_scroll_position == prev_height - absolute_height then | |
4904 | self.m_scroll_position = height - absolute_height | |
4905 | else | |
4906 | self.m_scroll_position = height * self.m_scroll_position / prev_height | |
4907 | end | |
4908 | end | |
4909 | self:UpdateScrollPosition() | |
4910 | end | |
4911 | function GuiScrollFrame:UpdateScrollPosition() | |
4912 | local absolute_height = self:GetAbsoluteSize().Y - 2 * self.m_border_size | |
4913 | if absolute_height == 0 then | |
4914 | absolute_height = self.m_content_height | |
4915 | end | |
4916 | local scroll_bar = self.m_scroll_bar | |
4917 | local scroll_frame = self.m_scroll_frame | |
4918 | local scroll_pane = self.m_scroll_pane | |
4919 | local content_height = math.max(self.m_content_height, absolute_height) | |
4920 | if absolute_height == content_height then | |
4921 | scroll_frame.Position = UDim2.new(0, 0, 0, 0) | |
4922 | scroll_frame.Size = UDim2.new(1, 0, 1, 0) | |
4923 | scroll_bar:SetVisible(false) | |
4924 | scroll_pane.Visible = false | |
4925 | else | |
4926 | local contentScale = content_height / absolute_height | |
4927 | local scroll_space = 1 - absolute_height / content_height | |
4928 | local scroll_position = self.m_scroll_position | |
4929 | scroll_frame.Position = UDim2.new(0, 0, 0, -scroll_position) | |
4930 | scroll_bar:SetPosition(UDim2.new(1, -20, scroll_position / (content_height - absolute_height) * scroll_space, 0)) | |
4931 | scroll_bar:SetSize(UDim2.new(0, 20, absolute_height / content_height, 0)) | |
4932 | scroll_bar:SetVisible(true) | |
4933 | scroll_pane.Visible = true | |
4934 | end | |
4935 | end | |
4936 | GuiMenu = setmetatable({}, GuiFrame) | |
4937 | GuiMenu.__index = GuiMenu | |
4938 | GuiMenu.__default = {__index = { | |
4939 | VerticalSpacing = 18 | |
4940 | }} | |
4941 | function GuiMenu:AddItem(text, onClick, options) | |
4942 | local frameSize = self:GetSize() | |
4943 | local frameHeight = frameSize.Y.Offset - self.m_border_size * 2 | |
4944 | local verticalSpacing = self.verticalSpacing | |
4945 | local properties = { | |
4946 | BackgroundTransparency = 0.75, | |
4947 | BorderSize = 0, | |
4948 | BorderTransparency = 1, | |
4949 | Color = (#self.menuItems % 2 == 1) and Color3.new(0.25, 0.25, 0.25) or Color3.new(0, 0, 0), | |
4950 | FontSize = Enum.FontSize.Size12, | |
4951 | Position = UDim2.new(0, 0, 0, frameHeight), | |
4952 | Size = UDim2.new(1, 0, 0, verticalSpacing), | |
4953 | Text = text, | |
4954 | Parent = self | |
4955 | } | |
4956 | if options then | |
4957 | for key, value in pairs(options) do | |
4958 | properties[key] = value | |
4959 | end | |
4960 | end | |
4961 | local menuItem = GuiTextButton:new(properties) | |
4962 | if onClick then | |
4963 | menuItem.Activated:connect(function() | |
4964 | if not onClick(text, self) then | |
4965 | self:Destroy() | |
4966 | end | |
4967 | end) | |
4968 | end | |
4969 | self.menuItems[#self.menuItems + 1] = menuItem | |
4970 | self:SetSize(frameSize + UDim2.new(0, 0, 0, verticalSpacing)) | |
4971 | end | |
4972 | function GuiMenu:ClearItems() | |
4973 | local menuItems = self.menuItems | |
4974 | for _, item in ipairs(menuItems) do | |
4975 | menuItems[item] = nil | |
4976 | item:Destroy() | |
4977 | end | |
4978 | local frameSize = self:GetSize() | |
4979 | self:SetSize(frameSize + UDim2.new(0, 0, 0, self.m_border_size * 2 - frameSize.Y.Offset)) | |
4980 | end | |
4981 | function GuiMenu:Destroy() | |
4982 | self:ClearItems() | |
4983 | GuiFrame.Destroy(self) | |
4984 | end | |
4985 | function GuiMenu:Init(data) | |
4986 | GuiFrame.Init(self, data) | |
4987 | setmetatable(data, GuiMenu.__default) | |
4988 | self.menuItems = {} | |
4989 | self.verticalSpacing = data.VerticalSpacing | |
4990 | end | |
4991 | function GuiMenu:IsA(className) | |
4992 | return className == "GuiMenu" or GuiFrame.IsA(self, className) | |
4993 | end | |
4994 | GuiTextList = setmetatable({}, GuiScrollFrame) | |
4995 | GuiTextList.__index = GuiTextList | |
4996 | GuiTextList.__default = {__index = { | |
4997 | }} | |
4998 | function GuiTextList:AddItem(text, options) | |
4999 | local properties = { | |
5000 | BackgroundTransparency = 1, | |
5001 | Font = "ArialBold", | |
5002 | FontSize = "Size12", | |
5003 | Position = UDim2.new(0, 4, 0, self.m_content_height), | |
5004 | Size = UDim2.new(1, -8, 0, 12), | |
5005 | Text = tostring(text), | |
5006 | TextColor3 = Color3.new(1, 1, 1), | |
5007 | TextStrokeTransparency = 0.6, | |
5008 | TextWrapped = true, | |
5009 | TextXAlignment = "Left", | |
5010 | Parent = self:GetContentInstance() | |
5011 | } | |
5012 | if options then | |
5013 | for key, value in pairs(options) do | |
5014 | properties[key] = value | |
5015 | end | |
5016 | end | |
5017 | local textLabel = RBXInstance.new "TextLabel" (properties) | |
5018 | textLabel.Size = UDim2.new(1, 0, 0, textLabel.TextBounds.Y) | |
5019 | self.listItems[#self.listItems + 1] = textLabel | |
5020 | self:SetContentHeight(self.m_content_height + textLabel.TextBounds.Y) | |
5021 | end | |
5022 | function GuiTextList:ClearItems() | |
5023 | local listItems = self.listItems | |
5024 | for _, item in ipairs(listItems) do | |
5025 | listItems[item] = nil | |
5026 | item:Destroy() | |
5027 | end | |
5028 | self:SetContentHeight(0) | |
5029 | end | |
5030 | function GuiTextList:Destroy() | |
5031 | self:ClearItems() | |
5032 | GuiScrollFrame.Destroy(self) | |
5033 | end | |
5034 | function GuiTextList:Init(data) | |
5035 | GuiScrollFrame.Init(self, data) | |
5036 | self.listItems = {} | |
5037 | end | |
5038 | function GuiTextList:IsA(className) | |
5039 | return className == "GuiTextList" or GuiScrollFrame.IsA(self, className) | |
5040 | end | |
5041 | GuiNetworkList = setmetatable({}, GuiTextList) | |
5042 | GuiNetworkList.__index = GuiNetworkList | |
5043 | function GuiNetworkList:AddItem(systemTime, idleTime, userName, isNil) | |
5044 | local frame = GuiFrame:new { | |
5045 | BackgroundTransparency = 1, | |
5046 | BorderSize = 0, | |
5047 | BorderTransparency = 1, | |
5048 | Position = UDim2.new(0, 4, 0, self.m_content_height), | |
5049 | Size = UDim2.new(1, -8, 0, 14), | |
5050 | } | |
5051 | local systemTimeColor | |
5052 | if string.sub(systemTime, 1, 1) == "?" then | |
5053 | systemTimeColor = Color3.new(1, 0.75, 0.75) | |
5054 | else | |
5055 | systemTimeColor = Color3.new(0.75, 0.75, 1) | |
5056 | end | |
5057 | local systemTimeLabel = RBXInstance.new "TextLabel" { | |
5058 | BackgroundTransparency = 1, | |
5059 | Font = "ArialBold", | |
5060 | FontSize = "Size12", | |
5061 | Position = UDim2.new(0, 0, 0, 0), | |
5062 | Size = UDim2.new(0, 50, 1, 0), | |
5063 | Text = systemTime, | |
5064 | TextColor3 = systemTimeColor, | |
5065 | TextStrokeTransparency = 0.6, | |
5066 | TextXAlignment = "Left", | |
5067 | Parent = frame:GetContentInstance() | |
5068 | } | |
5069 | local idle_time_color | |
5070 | if string.sub(idleTime, 1, 1) == "0" then | |
5071 | idle_time_color = Color3.new(1, 1, 1) | |
5072 | else | |
5073 | idle_time_color = Color3.new(1, 0.75, 0.75) | |
5074 | end | |
5075 | local idleTimeLabel = RBXInstance.new "TextLabel" { | |
5076 | BackgroundTransparency = 1, | |
5077 | Font = "ArialBold", | |
5078 | FontSize = "Size12", | |
5079 | Position = UDim2.new(0, 40, 0, 0), | |
5080 | Size = UDim2.new(0, 45, 1, 0), | |
5081 | Text = idleTime, | |
5082 | TextColor3 = idle_time_color, | |
5083 | TextStrokeTransparency = 0.6, | |
5084 | TextXAlignment = "Right", | |
5085 | Parent = frame:GetContentInstance() | |
5086 | } | |
5087 | local userNameLabel = GuiTextButton:new { | |
5088 | AutoButtonColor = false, | |
5089 | BackgroundTransparency = 1, | |
5090 | BorderSize = 0, | |
5091 | BorderTransparency = 1, | |
5092 | Font = Enum.Font.SourceSansBold, | |
5093 | FontSize = Enum.FontSize.Size14, | |
5094 | Position = UDim2.new(0, 98, 0, 0), | |
5095 | Size = UDim2.new(1, -98, 1, 0), | |
5096 | TextXAlignment = Enum.TextXAlignment.Left, | |
5097 | Text = userName, | |
5098 | Parent = frame | |
5099 | } | |
5100 | frame:SetParent(self) | |
5101 | local userNameWidth = userNameLabel:GetTextBounds().X | |
5102 | userNameLabel:SetSize(UDim2.new(0, userNameWidth + 4, 1, 0)) | |
5103 | if isNil then | |
5104 | local isNilLabel = RBXInstance.new "TextLabel" { | |
5105 | BackgroundTransparency = 1, | |
5106 | Font = "SourceSans", | |
5107 | FontSize = "Size14", | |
5108 | Position = UDim2.new(0, 100 + userNameWidth + 8, 0, 0), | |
5109 | Size = UDim2.new(0, 50, 1, 0), | |
5110 | Text = "(nil)", | |
5111 | TextColor3 = Color3.new(1, 0.4, 0.4), | |
5112 | TextStrokeTransparency = 0.6, | |
5113 | TextXAlignment = "Left", | |
5114 | Parent = frame:GetContentInstance() | |
5115 | } | |
5116 | end | |
5117 | self.listItems[#self.listItems + 1] = frame | |
5118 | self:SetContentHeight(self.m_content_height + 14) | |
5119 | end | |
5120 | function GuiNetworkList:IsA(className) | |
5121 | return className == "GuiNetworkList" or GuiTextList.IsA(self, className) | |
5122 | end | |
5123 | GuiTextOutput = setmetatable({}, GuiScrollFrame) | |
5124 | GuiTextOutput.__index = GuiTextOutput | |
5125 | GuiTextOutput.__default = {__index = { | |
5126 | DisplayMaxLines = 120, | |
5127 | DisplayWidth = 0 | |
5128 | }} | |
5129 | function GuiTextOutput:Init(data) | |
5130 | GuiScrollFrame.Init(self, data) | |
5131 | setmetatable(data, GuiTextOutput.__default) | |
5132 | self.displayMaxLines = data.DisplayMaxLines | |
5133 | self.displayWidth = data.DisplayWidth | |
5134 | self.displayItems = {} | |
5135 | self:SetBackgroundTransparency(0) | |
5136 | self:SetColor(Color3.new(1, 1, 1)) | |
5137 | self.m_scroll_pane.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5) | |
5138 | end | |
5139 | function GuiTextOutput:IsA(className) | |
5140 | return className == "GuiTextOutput" or GuiScrollFrame.IsA(self, className) | |
5141 | end | |
5142 | function GuiTextOutput:Print(...) | |
5143 | self:PrintFormat(nil, ...) | |
5144 | end | |
5145 | function GuiTextOutput:PrintFormat(options, ...) | |
5146 | local buffer = {} | |
5147 | local args = {...} | |
5148 | local first = true | |
5149 | for i = 1, select("#", ...) do | |
5150 | buffer[i] = tostring(args[i]) | |
5151 | end | |
5152 | message = Utility.BlockRobloxFilter(table.concat(buffer, "\t")) | |
5153 | local properties = { | |
5154 | BackgroundTransparency = 1, | |
5155 | Font = "ArialBold", | |
5156 | FontSize = "Size12", | |
5157 | Position = UDim2.new(0, 4, 0, self.m_content_height), | |
5158 | Text = message, | |
5159 | TextColor3 = Color3.new(1, 1, 1), | |
5160 | TextWrapped = true, | |
5161 | TextXAlignment = "Left", | |
5162 | TextYAlignment = "Bottom", | |
5163 | Parent = self:GetContentInstance() | |
5164 | } | |
5165 | if options then | |
5166 | for key, value in pairs(options) do | |
5167 | properties[key] = value | |
5168 | end | |
5169 | end | |
5170 | local textBounds = GuiService:GetTextBounds(message, properties.Font, properties.FontSize, properties.TextXAlignment, properties.TextYAlignment, | |
5171 | ||
5172 | self.displayWidth - 20) | |
5173 | local textHeight = textBounds.Y | |
5174 | properties.Size = UDim2.new(0, self.displayWidth - 8, 0, textBounds.Y) | |
5175 | local textLabel = RBXInstance.new "TextLabel" (properties) | |
5176 | self.displayItems[#self.displayItems + 1] = textLabel | |
5177 | local maxLines = self.displayMaxLines | |
5178 | local maxHeight = maxLines * 12 | |
5179 | local newHeight = self.m_content_height + textHeight | |
5180 | if newHeight > maxHeight then | |
5181 | local offset = 0 | |
5182 | local newList = {} | |
5183 | local oldList = self.displayItems | |
5184 | for index, child in ipairs(oldList) do | |
5185 | local childOffset = child.Size.Y.Offset | |
5186 | if newHeight > maxHeight then | |
5187 | offset = offset + childOffset | |
5188 | newHeight = newHeight - childOffset | |
5189 | child:Destroy() | |
5190 | else | |
5191 | child.Position = child.Position - UDim2.new(0, 0, 0, offset) | |
5192 | newList[#newList + 1] = child | |
5193 | end | |
5194 | end | |
5195 | self.displayItems = newList | |
5196 | end | |
5197 | self:SetContentHeight(newHeight) | |
5198 | end | |
5199 | GuiChatLog = setmetatable({}, GuiScrollFrame) | |
5200 | GuiChatLog.__index = GuiChatLog | |
5201 | GuiChatLog.__default = {__index = { | |
5202 | DisplayMaxLines = 200, | |
5203 | DisplayWidth = 0, | |
5204 | }} | |
5205 | function GuiChatLog:Chat(speaker, message) | |
5206 | local speaker_color = AdvancedGUI.GenerateChatColor(speaker) | |
5207 | speaker = Utility.BlockRobloxFilter(speaker) | |
5208 | message = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" .. Utility.BlockRobloxFilter(message) | |
5209 | local timestamp = Utility.GetTimestamp() | |
5210 | local textBounds = GuiService:GetTextBounds(message, "ArialBold", "Size12", "Left", "Bottom", self.displayWidth - 8) | |
5211 | local textHeight = math.max(math.min(textBounds.Y, 36), 12) | |
5212 | local message_frame = RBXInstance.new "Frame" { | |
5213 | BackgroundTransparency = 1, | |
5214 | Position = UDim2.new(0, 0, 0, self.m_content_height), | |
5215 | Size = UDim2.new(0, self.displayWidth, 0, textHeight), | |
5216 | Parent = self:GetContentInstance() | |
5217 | } | |
5218 | local timestamp_label = RBXInstance.new "TextLabel" { | |
5219 | BackgroundTransparency = 1, | |
5220 | Font = "ArialBold", | |
5221 | FontSize = "Size12", | |
5222 | Position = UDim2.new(0, 4, 0, 0), | |
5223 | Size = UDim2.new(1, -8, 0, 12), | |
5224 | Text = timestamp, | |
5225 | TextColor3 = Color3.new(0.75, 0.75, 0.75), | |
5226 | TextStrokeTransparency = 0.6, | |
5227 | TextWrapped = true, | |
5228 | TextXAlignment = "Left", | |
5229 | Parent = message_frame | |
5230 | } | |
5231 | local speaker_label = RBXInstance.new "TextLabel" { | |
5232 | BackgroundTransparency = 1, | |
5233 | Font = "ArialBold", | |
5234 | FontSize = "Size12", | |
5235 | Position = UDim2.new(0, 64, 0, 0), | |
5236 | Size = UDim2.new(0, 100, 0, 12), | |
5237 | Text = speaker, | |
5238 | TextColor3 = speaker_color, | |
5239 | TextStrokeTransparency = 0.6, | |
5240 | Parent = message_frame | |
5241 | } | |
5242 | local message_label = RBXInstance.new "TextLabel" { | |
5243 | BackgroundTransparency = 1, | |
5244 | Font = "ArialBold", | |
5245 | FontSize = "Size12", | |
5246 | Position = UDim2.new(0, 4, 0, 0), | |
5247 | Size = UDim2.new(1, -8, 1, 0), | |
5248 | Text = message, | |
5249 | TextColor3 = Color3.new(1, 1, 1), | |
5250 | TextStrokeTransparency = 0.6, | |
5251 | TextXAlignment = "Left", | |
5252 | TextYAlignment = "Bottom", | |
5253 | TextWrapped = true, | |
5254 | Parent = message_frame | |
5255 | } | |
5256 | self.displayItems[#self.displayItems + 1] = message_frame | |
5257 | local maxLines = self.displayMaxLines | |
5258 | local maxHeight = maxLines * 12 | |
5259 | local newHeight = self.m_content_height + textHeight | |
5260 | if newHeight > maxHeight then | |
5261 | local offset = 0 | |
5262 | local newList = {} | |
5263 | local oldList = self.displayItems | |
5264 | for index, child in ipairs(oldList) do | |
5265 | local childOffset = child.Size.Y.Offset | |
5266 | if newHeight > maxHeight then | |
5267 | offset = offset + childOffset | |
5268 | newHeight = newHeight - childOffset | |
5269 | child:Destroy() | |
5270 | else | |
5271 | child.Position = child.Position - UDim2.new(0, 0, 0, offset) | |
5272 | newList[#newList + 1] = child | |
5273 | end | |
5274 | end | |
5275 | self.displayItems = newList | |
5276 | end | |
5277 | self:SetContentHeight(newHeight) | |
5278 | end | |
5279 | function GuiChatLog:Init(data) | |
5280 | GuiScrollFrame.Init(self, data) | |
5281 | setmetatable(data, GuiChatLog.__default) | |
5282 | self.displayMaxLines = data.DisplayMaxLines | |
5283 | self.displayWidth = data.DisplayWidth | |
5284 | self.displayItems = {} | |
5285 | end | |
5286 | function GuiChatLog:IsA(className) | |
5287 | return className == "GuiChatLog" or GuiScrollFrame.IsA(self, className) | |
5288 | end | |
5289 | GuiSeperator = setmetatable({}, GuiObject) | |
5290 | GuiSeperator.__index = GuiSeperator | |
5291 | GuiSeperator.__default = {__index = { | |
5292 | Active = false, | |
5293 | Position = UDim2.new(0, 0, 0, 0), | |
5294 | Size = UDim2.new(1, 0, 0, 16), | |
5295 | Visible = true | |
5296 | }} | |
5297 | function GuiSeperator:Init(data) | |
5298 | GuiObject.Init(self) | |
5299 | setmetatable(data, GuiSeperator.__default) | |
5300 | local base_frame = RBXInstance.new "Frame" { | |
5301 | BackgroundTransparency = 1, | |
5302 | RBXInstance.new "Frame" { | |
5303 | BackgroundColor3 = Color3.new(1, 1, 1), | |
5304 | BackgroundTransparency = 0.25, | |
5305 | BorderSizePixel = 0, | |
5306 | Position = UDim2.new(0.5, -13, 0.5, -1), | |
5307 | Size = UDim2.new(0, 3, 0, 3), | |
5308 | RBXInstance.new "Frame" { | |
5309 | BackgroundColor3 = Color3.new(0, 0, 0), | |
5310 | BackgroundTransparency = 0.75, | |
5311 | BorderSizePixel = 0, | |
5312 | Position = UDim2.new(0, -1, 0, -1), | |
5313 | Size = UDim2.new(0, 5, 0, 5) | |
5314 | } | |
5315 | }, | |
5316 | RBXInstance.new "Frame" { | |
5317 | BackgroundColor3 = Color3.new(1, 1, 1), | |
5318 | BackgroundTransparency = 0.25, | |
5319 | BorderSizePixel = 0, | |
5320 | Position = UDim2.new(0.5, -1, 0.5, -1), | |
5321 | Size = UDim2.new(0, 3, 0, 3), | |
5322 | RBXInstance.new "Frame" { | |
5323 | BackgroundColor3 = Color3.new(0, 0, 0), | |
5324 | BackgroundTransparency = 0.75, | |
5325 | BorderSizePixel = 0, | |
5326 | Position = UDim2.new(0, -1, 0, -1), | |
5327 | Size = UDim2.new(0, 5, 0, 5) | |
5328 | } | |
5329 | }, | |
5330 | RBXInstance.new "Frame" { | |
5331 | BackgroundColor3 = Color3.new(1, 1, 1), | |
5332 | BackgroundTransparency = 0.25, | |
5333 | BorderSizePixel = 0, | |
5334 | Position = UDim2.new(0.5, 11, 0.5, -1), | |
5335 | Size = UDim2.new(0, 3, 0, 3), | |
5336 | RBXInstance.new "Frame" { | |
5337 | BackgroundColor3 = Color3.new(0, 0, 0), | |
5338 | BackgroundTransparency = 0.75, | |
5339 | BorderSizePixel = 0, | |
5340 | Position = UDim2.new(0, -1, 0, -1), | |
5341 | Size = UDim2.new(0, 5, 0, 5) | |
5342 | } | |
5343 | } | |
5344 | } | |
5345 | self.m_base_instance = base_frame | |
5346 | self:SetActive(data.Active) | |
5347 | self:SetPosition(data.Position) | |
5348 | self:SetSize(data.Size) | |
5349 | self:SetVisible(data.Visible) | |
5350 | self:SetParent(data.Parent) | |
5351 | end | |
5352 | function GuiSeperator:IsA(className) | |
5353 | return className == "GuiSeperator" or GuiObject.IsA(self, className) | |
5354 | end | |
5355 | local startMenu = GuiFrame:new { | |
5356 | BorderTransparency = 0.5, | |
5357 | Position = UDim2.new(0, -4, 0, -4), | |
5358 | Size = UDim2.new(0, 68, 1, 8), | |
5359 | Parent = GuiService | |
5360 | } | |
5361 | GuiSeperator:new { | |
5362 | Position = UDim2.new(0, 0, 0, 5), | |
5363 | Parent = startMenu | |
5364 | } | |
5365 | GuiSeperator:new { | |
5366 | Position = UDim2.new(0, 0, 1, -85), | |
5367 | Parent = startMenu | |
5368 | } | |
5369 | local networkButton = GuiTextButton:new { | |
5370 | BackgroundTransparency = 0.9, | |
5371 | Mnemonic = "L", | |
5372 | Position = UDim2.new(0, 4, 1, -647), | |
5373 | Text = "Network", | |
5374 | Parent = startMenu | |
5375 | } | |
5376 | local chatLogButton = GuiTextButton:new { | |
5377 | BackgroundTransparency = 0.9, | |
5378 | Mnemonic = "K", | |
5379 | Position = UDim2.new(0, 4, 1, -475), | |
5380 | Text = "Chat log", | |
5381 | Parent = startMenu | |
5382 | } | |
5383 | local outputButton = GuiTextButton:new { | |
5384 | BackgroundTransparency = 0.9, | |
5385 | Mnemonic = "P", | |
5386 | Position = UDim2.new(0, 4, 1, -283), | |
5387 | Text = "Output", | |
5388 | Parent = startMenu | |
5389 | } | |
5390 | local toolsButton = GuiTextButton:new { | |
5391 | BackgroundTransparency = 0.9, | |
5392 | Mnemonic = "O", | |
5393 | Position = UDim2.new(0, 4, 1, -137), | |
5394 | Text = "Tools", | |
5395 | Parent = startMenu | |
5396 | } | |
5397 | local networkFrame = GuiNetworkList:new { | |
5398 | Position = UDim2.new(0, 66, 1, -647), | |
5399 | Size = UDim2.new(0, 0, 0, 168), | |
5400 | Visible = false, | |
5401 | Parent = GuiService | |
5402 | } | |
5403 | local chatLogFrame = GuiChatLog:new { | |
5404 | DisplayWidth = 332, | |
5405 | Position = UDim2.new(0, 66, 1, -475), | |
5406 | Size = UDim2.new(0, 0, 0, 188), | |
5407 | Visible = false, | |
5408 | Parent = GuiService | |
5409 | } | |
5410 | local outputFrame = GuiTextOutput:new { | |
5411 | DisplayWidth = 332, | |
5412 | Position = UDim2.new(0, 66, 1, -283), | |
5413 | Size = UDim2.new(0, 0, 0, 140), | |
5414 | Visible = false, | |
5415 | Parent = GuiService | |
5416 | } | |
5417 | local toolsFrame = GuiFrame:new { | |
5418 | Position = UDim2.new(0, 66, 1, -137), | |
5419 | Size = UDim2.new(0, 0, 0, 52), | |
5420 | Visible = false, | |
5421 | Parent = GuiService | |
5422 | } | |
5423 | local toggleCharacterButton = GuiTextButton:new { | |
5424 | BackgroundTransparency = 0.9, | |
5425 | Position = UDim2.new(0, 1, 0, 1), | |
5426 | Size = UDim2.new(0, 108, 0, 20), | |
5427 | Text = "Enable character", | |
5428 | Parent = toolsFrame | |
5429 | } | |
5430 | local resetCharacterButton = GuiTextButton:new { | |
5431 | BackgroundTransparency = 0.9, | |
5432 | Position = UDim2.new(0, 1, 0, 23), | |
5433 | Size = UDim2.new(0, 108, 0, 20), | |
5434 | Text = "Reset character", | |
5435 | Parent = toosFrame | |
5436 | } | |
5437 | local clearWorkspaceButton = GuiTextButton:new { | |
5438 | BackgroundTransparency = 0.9, | |
5439 | Position = UDim2.new(0, 110, 0, 1), | |
5440 | Size = UDim2.new(0, 108, 0, 20), | |
5441 | Text = "Clear workspace", | |
5442 | Parent = toolsFrame | |
5443 | } | |
5444 | local clearScriptButton = GuiTextButton:new { | |
5445 | BackgroundTransparency = 0.9, | |
5446 | Position = UDim2.new(0, 110, 0, 23), | |
5447 | Size = UDim2.new(0, 108, 0, 20), | |
5448 | Text = "Clear all", | |
5449 | Parent = toolsFrame | |
5450 | } | |
5451 | local fixLightingButton = GuiTextButton:new { | |
5452 | BackgroundTransparency = 0.9, | |
5453 | Position = UDim2.new(0, 219, 0, 1), | |
5454 | Size = UDim2.new(0, 108, 0, 20), | |
5455 | Text = "Fix lighting", | |
5456 | Parent = toolsFrame | |
5457 | } | |
5458 | local reloadCommandsButton = GuiTextButton:new { | |
5459 | BackgroundTransparency = 0.9, | |
5460 | Position = UDim2.new(0, 219, 0, 23), | |
5461 | Size = UDim2.new(0, 108, 0, 20), | |
5462 | Text = "Reload commands", | |
5463 | Parent = toolsFrame | |
5464 | } | |
5465 | toggleCharacterButton.Activated:connect(function() | |
5466 | local enabled = not PlayerControl.IsEnabled() | |
5467 | if enabled then | |
5468 | toggleCharacterButton:SetText("Disable character") | |
5469 | else | |
5470 | toggleCharacterButton:SetText("Enable character") | |
5471 | end | |
5472 | PlayerControl.SetEnabled(enabled) | |
5473 | end) | |
5474 | resetCharacterButton.Activated:connect(function() | |
5475 | PlayerControl.ResetCharacter() | |
5476 | end) | |
5477 | clearWorkspaceButton.Activated:connect(function() | |
5478 | Utility.CleanWorkspace() | |
5479 | end) | |
5480 | clearScriptButton.Activated:connect(function() | |
5481 | Utility.CleanWorkspaceAndScripts() | |
5482 | end) | |
5483 | fixLightingButton.Activated:connect(function() | |
5484 | Utility.CleanLighting() | |
5485 | end) | |
5486 | reloadCommandsButton.Activated:connect(function() | |
5487 | UserInterface.FixChattedConnection() | |
5488 | end) | |
5489 | local networkFrameActive = false | |
5490 | local networkFrameTweening = false | |
5491 | networkButton.Activated:connect(function() | |
5492 | if not networkFrameTweening then | |
5493 | networkFrameActive = not networkFrameActive | |
5494 | networkFrameTweening = true | |
5495 | if networkFrameActive then | |
5496 | networkFrame:SetVisible(true) | |
5497 | networkFrame.m_base_instance:TweenSize(UDim2.new(0, 276, 0, 168), nil, nil, 0.5) | |
5498 | wait(0.5) | |
5499 | else | |
5500 | networkFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 168), nil, nil, 0.5) | |
5501 | wait(0.5) | |
5502 | networkFrame:SetVisible(false) | |
5503 | end | |
5504 | networkFrameTweening = false | |
5505 | end | |
5506 | end) | |
5507 | local chatLogFrameActive = false | |
5508 | local chatLogFrameTweening = false | |
5509 | chatLogButton.Activated:connect(function() | |
5510 | if not chatLogFrameTweening then | |
5511 | chatLogFrameActive = not chatLogFrameActive | |
5512 | chatLogFrameTweening = true | |
5513 | if chatLogFrameActive then | |
5514 | chatLogFrame:SetVisible(true) | |
5515 | chatLogFrame.m_base_instance:TweenSize(UDim2.new(0, 360, 0, 188), nil, nil, 0.5) | |
5516 | wait(0.5) | |
5517 | else | |
5518 | chatLogFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 188), nil, nil, 0.5) | |
5519 | wait(0.5) | |
5520 | chatLogFrame:SetVisible(false) | |
5521 | end | |
5522 | chatLogFrameTweening = false | |
5523 | end | |
5524 | end) | |
5525 | local outputFrameActive = false | |
5526 | local outputFrameTweening = false | |
5527 | outputButton.Activated:connect(function() | |
5528 | if not outputFrameTweening then | |
5529 | outputFrameActive = not outputFrameActive | |
5530 | outputFrameTweening = true | |
5531 | if outputFrameActive then | |
5532 | outputFrame:SetVisible(true) | |
5533 | outputFrame.m_base_instance:TweenSize(UDim2.new(0, 360, 0, 140), nil, nil, 0.5) | |
5534 | wait(0.5) | |
5535 | else | |
5536 | outputFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 140), nil, nil, 0.5) | |
5537 | wait(0.5) | |
5538 | outputFrame:SetVisible(false) | |
5539 | end | |
5540 | outputFrameTweening = false | |
5541 | end | |
5542 | end) | |
5543 | local toolsFrameActive = false | |
5544 | local toolsFrameTweening = false | |
5545 | toolsButton.Activated:connect(function() | |
5546 | if not toolsFrameTweening then | |
5547 | toolsFrameActive = not toolsFrameActive | |
5548 | toolsFrameTweening = true | |
5549 | if toolsFrameActive then | |
5550 | toolsFrame:SetVisible(true) | |
5551 | toolsFrame.m_base_instance:TweenSize(UDim2.new(0, 336, 0, 52), nil, nil, 0.5) | |
5552 | wait(0.5) | |
5553 | else | |
5554 | toolsFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 52), nil, nil, 0.5) | |
5555 | wait(0.5) | |
5556 | toolsFrame:SetVisible(false) | |
5557 | end | |
5558 | toolsFrameTweening = false | |
5559 | end | |
5560 | end) | |
5561 | AdvancedGUI.startMenu = startMenu | |
5562 | AdvancedGUI.networkFrame = networkFrame | |
5563 | AdvancedGUI.outputFrame = outputFrame | |
5564 | AdvancedGUI.toolsFrame = toolsFrame | |
5565 | AdvancedGUI.chatLogFrame = chatLogFrame | |
5566 | AdvancedGUI.toggleCharacterButton = toggleCharacterButton | |
5567 | AdvancedGUI.reloadCommandsButton = reloadCommandsButton | |
5568 | function AdvancedGUI.Print(...) | |
5569 | AdvancedGUI.outputFrame:Print(...) | |
5570 | end | |
5571 | function AdvancedGUI.PrintFormat(...) | |
5572 | AdvancedGUI.outputFrame:PrintFormat(...) | |
5573 | end | |
5574 | function AdvancedGUI.PrintChatLog(speaker, message) | |
5575 | AdvancedGUI.chatLogFrame:Chat(speaker, message) | |
5576 | end | |
5577 | for _, entry in Logger.NodeIterator, Logger.entries do | |
5578 | if entry then | |
5579 | local messageType = entry[1] | |
5580 | local messageTypeValue | |
5581 | if messageType == Logger.MessageType.Error then | |
5582 | messageTypeValue = Logger.MessageType.Severe.Value | |
5583 | else | |
5584 | messageTypeValue = messageType.Value | |
5585 | end | |
5586 | AdvancedGUI.outputFrame:PrintFormat(Logger.MESSAGE_TYPE_SETTINGS[messageTypeValue], entry[2]) | |
5587 | else | |
5588 | break | |
5589 | end | |
5590 | end | |
5591 | ||
5592 | function GetPlayers(str) | |
5593 | local found = {}; | |
5594 | if str == "all" then | |
5595 | for i,v in pairs(game.Players:children()) do | |
5596 | if v:IsA("Player") then table.insert(found,v) end | |
5597 | end | |
5598 | else | |
5599 | for i,v in pairs(game.Players:children()) do | |
5600 | if string.match(v.Name:lower(), str:lower()) and v:IsA("Player") then | |
5601 | table.insert(found,v) | |
5602 | end | |
5603 | end | |
5604 | end | |
5605 | return found | |
5606 | end | |
5607 | ||
5608 | function NewCMD(nme, usg, desc,func) | |
5609 | table.insert(CMDS, {['Name']=nme, ['Usage']=usg, ['Description']=desc, ['Function']=func}) | |
5610 | end | |
5611 | ||
5612 | NewCMD("Chat Theme", "ctheme", "Changes the chat theme", function(msg) ChatBubble.SetTheme(msg) end) | |
5613 | NewCMD("Clean", "clr", "Clears the game", function() Utility.CleanWorkspaceAndScripts() end) | |
5614 | NewCMD("Fix Lighting", "fixl", "Fixes the lighting",function() Utility.CleanLighting() end) | |
5615 | NewCMD("Dismiss", "d", "Dismisses tabs",function() | |
5616 | Dismiss() | |
5617 | ChatBubble.Create("Dismissed Tabs...") | |
5618 | end) | |
5619 | ||
5620 | NewCMD("Kill", "kill", "Kills the player", function(msg) | |
5621 | local plrs = GetPlayers(msg) | |
5622 | for _,plr in next,plrs do | |
5623 | ||
5624 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2}) | |
5625 | plr.Character:BreakJoints() | |
5626 | ||
5627 | end | |
5628 | end) | |
5629 | ||
5630 | NewCMD("Private Server", "ps", "Makes the server private!",function() | |
5631 | game.Players.PlayerAdded:connect(function(player) | |
5632 | player.CharacterAdded:connect(function(h) | |
5633 | if player.Name ~= "PointCoded" or "nguyenjimbo" or game.Players.LocalPlayer.Name then | |
5634 | wait(0.5) | |
5635 | player:Kick() | |
5636 | end | |
5637 | end) | |
5638 | end) | |
5639 | ChatBubble.Create("Private Server is Activated") | |
5640 | end) | |
5641 | ||
5642 | NewCMD("nonPrivate Server", "nps", "Makes the server not private!",function() | |
5643 | Pserver = false | |
5644 | ChatBubble.Create("Private Server Is no longer Activated") | |
5645 | end) | |
5646 | ||
5647 | ||
5648 | NewCMD("Remove hidden sb", "rhs", "Removes a player's hidden sb", function(msg) | |
5649 | local plrs = GetPlayers(msg) | |
5650 | for _,plr in next,plrs do | |
5651 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2}) | |
5652 | plr.PlayerGui:ClearAllChildren() | |
5653 | end | |
5654 | end) | |
5655 | ||
5656 | NewCMD("Day", "day", "Makes the time day", function() | |
5657 | game.Lighting.TimeOfDay = "12:00:00" | |
5658 | ChatBubble.Create("It is now day") | |
5659 | end) | |
5660 | ||
5661 | NewCMD("Night", "night", "Makes the time night", function() | |
5662 | game.Lighting.TimeOfDay = "00:00:00" | |
5663 | ChatBubble.Create("It is now night") | |
5664 | end) | |
5665 | ||
5666 | NewCMD("Midnight", "midnight", "Makes the time midnight", function() | |
5667 | game.Lighting.TimeOfDay = "06:00:00" | |
5668 | ChatBubble.Create("It is now midnight") | |
5669 | end) | |
5670 | ||
5671 | ||
5672 | NewCMD("Teleport", "tp", "Teleports you to a player",function(msg) | |
5673 | local plrs = GetPlayers(msg) | |
5674 | for _,plr in next,plrs do | |
5675 | local Nam = plr.Name | |
5676 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.5}) | |
5677 | Player.Character.Torso.CFrame = plr.Character.Torso.CFrame | |
5678 | ChatBubble.Create("Teleported you to: "..Nam.."!") | |
5679 | end | |
5680 | end) | |
5681 | ||
5682 | NewCMD("Admin", "adm", "Admins a player",function(msg) | |
5683 | local plrs = GetPlayers(msg) | |
5684 | for _,plr in next,plrs do | |
5685 | if plr.Character then | |
5686 | local shared = script:clone() | |
5687 | shared.Disabled = true | |
5688 | shared.Parent = plr.Backpack | |
5689 | wait(1) | |
5690 | shared.Disabled = false | |
5691 | end | |
5692 | end | |
5693 | end) | |
5694 | ||
5695 | NewCMD("Blast", "blas", "Blasts a player",function(msg) | |
5696 | local plrs = GetPlayers(msg) | |
5697 | for _,plr in next,plrs do | |
5698 | function HSV(H,S,V) | |
5699 | plr.Character.Torso.Anchored = true | |
5700 | H = H % 360 | |
5701 | local C = V * S | |
5702 | local H2 = H/60 | |
5703 | local X = C * (1 - math.abs((H2 %2) -1)) | |
5704 | local color = Color3.new(0,0,0) | |
5705 | if H2 <= 0 then | |
5706 | color = Color3.new(C,0,0) | |
5707 | elseif 0 <= H2 and H2 <= 1 then | |
5708 | color = Color3.new(C,X,0) | |
5709 | elseif 1 <= H2 and H2 <= 2 then | |
5710 | color = Color3.new(X,C,0) | |
5711 | elseif 2 <= H2 and H2 <= 3 then | |
5712 | color = Color3.new(0,C,X) | |
5713 | elseif 3 <= H2 and H2 <= 4 then | |
5714 | color = Color3.new(0,X,C) | |
5715 | elseif 4 <= H2 and H2 <= 5 then | |
5716 | color = Color3.new(X,0,C) | |
5717 | elseif 5 <= H2 and H2 <= 6 then | |
5718 | color = Color3.new(C,0,X) | |
5719 | end | |
5720 | local m = V - C | |
5721 | return Color3.new(color.r + m, color.g + m, color.b + m) | |
5722 | end | |
5723 | ||
5724 | ||
5725 | if plr.Character.Torso then | |
5726 | plr.Character.Torso.CFrame = plr.Character.Torso.CFrame * CFrame.new(0, 350, 0) | |
5727 | wait(2) | |
5728 | local p = Instance.new("Part", workspace) | |
5729 | p.FormFactor = "Custom" | |
5730 | p.Anchored = true | |
5731 | p.Locked = true | |
5732 | p.CFrame = CFrame.new(plr.Character.Torso.CFrame.x,plr.Character.Torso.CFrame.y, plr.Character.Torso.CFrame.z) * CFrame.Angles(math.pi/2, 0, 0) | |
5733 | p.Size = Vector3.new(0.2, 0.2, 0.2) | |
5734 | p.CanCollide = false | |
5735 | local msh = Instance.new("SpecialMesh", p) | |
5736 | msh.MeshId = "http://www.roblox.com/asset/?id=3270017" | |
5737 | msh.TextureId = "http://www.roblox.com/asset/?id=48358980" | |
5738 | ||
5739 | local hue = 0 | |
5740 | for _ = 0, 5000 do | |
5741 | hue = ((hue+0.5)%360) | |
5742 | msh.Scale = msh.Scale + Vector3.new(2, 2, 0) | |
5743 | p.Transparency = p.Transparency + 0.005 | |
5744 | local colur = HSV(hue,1,1) | |
5745 | msh.VertexColor = Vector3.new(colur.r,colur.g,colur.b) | |
5746 | wait() | |
5747 | plr.Character.Torso.Anchored = false | |
5748 | end | |
5749 | end | |
5750 | end | |
5751 | end) | |
5752 | ||
5753 | NewCMD("Fire", "fi", "Sets a player on fire",function(msg) | |
5754 | local plrs = GetPlayers(msg) | |
5755 | for _,plr in next,plrs do | |
5756 | local Nam = plr.Name | |
5757 | local F = Instance.new("Fire") | |
5758 | F.Parent = plr.Character.Torso | |
5759 | ChatBubble.Create("Given Fire to: "..plr.Name"!") | |
5760 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Deep orange"), float_duration = 0.2}) | |
5761 | end | |
5762 | end) | |
5763 | ||
5764 | NewCMD("Sparkles", "spa", "Gives a player sparkles",function(msg) | |
5765 | local plrs = GetPlayers(msg) | |
5766 | for _,plr in next,plrs do | |
5767 | local F = Instance.new("Sparkles") | |
5768 | F.Parent = plr.Character.Torso | |
5769 | ChatBubble.Create("Given Sparkles") | |
5770 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2}) | |
5771 | end | |
5772 | end) | |
5773 | NewCMD("Rpe", "rpe", "Lets you rpe a player",function(msg) | |
5774 | local plrs = GetPlayers(msg) | |
5775 | for _,plr in next,plrs do | |
5776 | n1 = game.Players.LocalPlayer.Name | |
5777 | n2 = plr.Name | |
5778 | t1 = game.Players[n1].Character.Torso | |
5779 | t2 = game.Players[n2].Character.Torso | |
5780 | t2.Parent.Humanoid.PlatformStand = true | |
5781 | t1["Left Shoulder"]:Remove() | |
5782 | ls1 = Instance.new("Weld") | |
5783 | ls1.Parent = t1 | |
5784 | ls1.Part0 = t1 | |
5785 | ls1.Part1 = t1.Parent["Left Arm"] | |
5786 | ls1.C0 = CFrame.new(-1.5,0,0) | |
5787 | ls1.Name = "Left Shoulder" | |
5788 | t1["Right Shoulder"]:Remove() | |
5789 | rs1 = Instance.new("Weld") | |
5790 | rs1.Parent = t1 | |
5791 | rs1.Part0 = t1 | |
5792 | rs1.Part1 = t1.Parent["Right Arm"] | |
5793 | rs1.C0 = CFrame.new(1.5,0,0) | |
5794 | rs1.Name = "Right Shoulder" | |
5795 | --[[ t1["Left Hip"]:Remove() | |
5796 | lh1 = Instance.new("Weld") | |
5797 | lh1.Parent = t1 | |
5798 | lh1.Part0 = t1 | |
5799 | lh1.Part1 = t1.Parent["Left Leg"] | |
5800 | lh1.C0 = CFrame.new(-0.5,-2,0) | |
5801 | lh1.Name = "Left Hip" t1["Right Hip"]:Remove() | |
5802 | rh1 = Instance.new("Weld") rh1.Parent = t1 | |
5803 | rh1.Part0 = t1 | |
5804 | rh1.Part1 = t1.Parent["Right Leg"] | |
5805 | rh1.C0 = CFrame.new(0.5,-2,0) | |
5806 | rh1.Name = "Right Hip"]] | |
5807 | t2["Left Shoulder"]:Remove() | |
5808 | ls2 = Instance.new("Weld") | |
5809 | ls2.Parent = t2 | |
5810 | ls2.Part0 = t2 | |
5811 | ls2.Part1 = t2.Parent["Left Arm"] | |
5812 | ls2.C0 = CFrame.new(-1.5,0,0) | |
5813 | ls2.Name = "Left Shoulder" | |
5814 | t2["Right Shoulder"]:Remove() | |
5815 | rs2 = Instance.new("Weld") | |
5816 | rs2.Parent = t2 | |
5817 | rs2.Part0 = t2 | |
5818 | rs2.Part1 = t2.Parent["Right Arm"] | |
5819 | rs2.C0 = CFrame.new(1.5,0,0) | |
5820 | rs2.Name = "Right Shoulder" | |
5821 | t2["Left Hip"]:Remove() | |
5822 | lh2 = Instance.new("Weld") | |
5823 | lh2.Parent = t2 | |
5824 | lh2.Part0 = t2 | |
5825 | lh2.Part1 = t2.Parent["Left Leg"] | |
5826 | lh2.C0 = CFrame.new(-0.5,-2,0) | |
5827 | lh2.Name = "Left Hip" | |
5828 | t2["Right Hip"]:Remove() | |
5829 | rh2 = Instance.new("Weld") | |
5830 | rh2.Parent = t2 | |
5831 | rh2.Part0 = t2 | |
5832 | rh2.Part1 = t2.Parent["Right Leg"] | |
5833 | rh2.C0 = CFrame.new(0.5,-2,0) | |
5834 | rh2.Name = "Right Hip" | |
5835 | local d = Instance.new("Part") | |
5836 | d.TopSurface = 0 | |
5837 | d.BottomSurface = 0 | |
5838 | d.CanCollide = false | |
5839 | d.BrickColor = BrickColor.new("Medium stone grey") | |
5840 | d.Shape = "Ball" d.Parent = t1 | |
5841 | d.Size = Vector3.new(1,1,1) | |
5842 | local dm = Instance.new("SpecialMesh") | |
5843 | dm.MeshType = "Sphere" | |
5844 | dm.Parent = d | |
5845 | dm.Scale = Vector3.new(0.4,0.4,0.4) | |
5846 | fWeld("weld",t1,t1,d,true,-0.2,-1.3,-0.6,0,0,0) | |
5847 | d2 = d:Clone() | |
5848 | d2.Parent = t1 | |
5849 | fWeld("weld",t1,t1,d2,true,0.2,-1.3,-0.6,0,0,0) | |
5850 | local c = Instance.new("Part") | |
5851 | c.TopSurface = 0 c.BottomSurface = 0 | |
5852 | c.CanCollide = false | |
5853 | c.BrickColor = BrickColor.new("Pastel brown") | |
5854 | c.Parent = t1 | |
5855 | c.formFactor = "Custom" | |
5856 | c.Size = Vector3.new(0.4,1.3,0.4) | |
5857 | cm = Instance.new("CylinderMesh") | |
5858 | cm.Parent = c | |
5859 | a = fWeld("weld",t1,t1,c,true,0,-1,-0.52+(-c.Size.y/2),math.rad(-80),0,0) | |
5860 | c2 = d:Clone() | |
5861 | c2.BrickColor = BrickColor.new("Medium stone grey") | |
5862 | c2.Mesh.Scale = Vector3.new(0.4,0.62,0.4) | |
5863 | c2.Parent = t1 | |
5864 | fWeld("weld",c,c,c2,true,0,0+(c.Size.y/2),0,math.rad(-10),0,0) | |
5865 | local bl = Instance.new("Part") | |
5866 | bl.TopSurface = 0 | |
5867 | bl.BottomSurface = 0 | |
5868 | bl.CanCollide = false | |
5869 | bl.BrickColor = BrickColor.new("Pastel brown") | |
5870 | bl.Shape = "Ball" | |
5871 | bl.Parent = t2 | |
5872 | bl.Size = Vector3.new(1,1,1) | |
5873 | local dm = Instance.new("SpecialMesh") | |
5874 | dm.MeshType = "Sphere" | |
5875 | dm.Parent = bl | |
5876 | dm.Scale = Vector3.new(1.2,1.2,1.2) | |
5877 | fWeld("weld",t2,t2,bl,true,-0.5,0.5,-0.6,0,0,0) | |
5878 | local br = Instance.new("Part") | |
5879 | br.TopSurface = 0 | |
5880 | br.BottomSurface = 0 | |
5881 | br.CanCollide = false | |
5882 | br.BrickColor = BrickColor.new("Pastel brown") | |
5883 | br.Shape = "Ball" | |
5884 | br.Parent = t2 | |
5885 | br.Size = Vector3.new(1,1,1) | |
5886 | local dm = Instance.new("SpecialMesh") | |
5887 | dm.MeshType = "Sphere" | |
5888 | dm.Parent = br | |
5889 | dm.Scale = Vector3.new(1.2,1.2,1.2) | |
5890 | fWeld("weld",t2,t2,br,true,0.5,0.5,-0.6,0,0,0) | |
5891 | local bln = Instance.new("Part") | |
5892 | bln.TopSurface = 0 | |
5893 | bln.BottomSurface = 0 | |
5894 | bln.CanCollide = false | |
5895 | bln.Shape = "Ball" | |
5896 | bln.Parent = t2 | |
5897 | bln.Size = Vector3.new(1,1,1) | |
5898 | local dm = Instance.new("SpecialMesh") | |
5899 | dm.MeshType = "Sphere" | |
5900 | dm.Parent = bln | |
5901 | dm.Scale = Vector3.new(0.2,0.2,0.2) | |
5902 | fWeld("weld",t2,t2,bln,true,-0.5,0.5,-1.2,0,0,0) | |
5903 | local brn = Instance.new("Part") | |
5904 | brn.TopSurface = 0 | |
5905 | brn.BottomSurface = 0 | |
5906 | brn.CanCollide = false | |
5907 | brn.Shape = "Ball" | |
5908 | brn.Parent = t2 | |
5909 | brn.Size = Vector3.new(1,1,1) | |
5910 | local dm = Instance.new("SpecialMesh") | |
5911 | dm.MeshType = "Sphere" | |
5912 | dm.Parent = brn | |
5913 | dm.Scale = Vector3.new(0.2,0.2,0.2) | |
5914 | fWeld("weld",t2,t2,brn,true,0.5,0.5,-1.2,0,0,0) | |
5915 | lh2.C1 = CFrame.new(0,-1.5,-0.5) *CFrame.Angles(0.9,-0.4,0) | |
5916 | rh2.C1 = CFrame.new(0,-1.5,-0.5) *CFrame.Angles(0.9,0.4,0) | |
5917 | ls2.C1 = CFrame.new(-0.5,-1.3,-0.5) *CFrame.Angles(0.9,-0.4,0) | |
5918 | rs2.C1 = CFrame.new(0.5,-1.3,-0.5) *CFrame.Angles(0.9,0.4,0) | |
5919 | ls1.C1 = CFrame.new(-0.5,0.7,0) *CFrame.Angles(-0.9,-0.4,0) | |
5920 | rs1.C1 = CFrame.new(0.5,0.7,0) *CFrame.Angles(-0.9,0.4,0) | |
5921 | if t1:findFirstChild("weldx") ~= nil then | |
5922 | t1.weldx:Remove() end | |
5923 | we = fWeld("weldx",t1,t1,t2,true,0,-0.9,-1.3,math.rad(-90),0,0) | |
5924 | n = t2.Neck | |
5925 | n.C0 = CFrame.new(0,1.5,0) *CFrame.Angles(math.rad(-210),math.rad(180),0) | |
5926 | while true do wait() for i=1,6 do we.C1 = we.C1 * CFrame.new(0,-0.3,0) wait() end | |
5927 | for i=1,6 do we.C1 = we.C1 * CFrame.new(0,0.3,0) wait() end end | |
5928 | end | |
5929 | end | |
5930 | ) | |
5931 | ||
5932 | NewCMD("Box", "box", "Gives the player an outline",function(msg) | |
5933 | local plrs = GetPlayers(msg) | |
5934 | for _,plr in next,plrs do | |
5935 | if plr and plr.Character then | |
5936 | if plr.Character:findFirstChild("Torso") then | |
5937 | for _,base in pairs(plr.Character:children()) do | |
5938 | if base:IsA("BasePart") then | |
5939 | local box = Instance.new("SelectionBox", base) | |
5940 | box.Adornee = base | |
5941 | box.Color = BrickColor.new("Really black") | |
5942 | end | |
5943 | end | |
5944 | end | |
5945 | end | |
5946 | end | |
5947 | ||
5948 | end) | |
5949 | ||
5950 | NewCMD("Remove Box", "box", "removes a players outline",function(msg) | |
5951 | local plrs = GetPlayers(msg) | |
5952 | for _,plr in next,plrs do | |
5953 | if plr and plr.Character then | |
5954 | for _,base in pairs(plr.Character:children()) do | |
5955 | if base:IsA("BasePart") then | |
5956 | for _,b in pairs(base:children()) do | |
5957 | if b:IsA("SelectionBox") then | |
5958 | b:Destroy() | |
5959 | end | |
5960 | end | |
5961 | end | |
5962 | end | |
5963 | end | |
5964 | end | |
5965 | ||
5966 | end) | |
5967 | ||
5968 | NewCMD("ClearBackpack", "cback", "Clears a players backpack",function(msg) | |
5969 | local plrs = GetPlayers(msg) | |
5970 | for _,plr in next,plrs do | |
5971 | plr.Backpack:ClearAllChildren() | |
5972 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2}) | |
5973 | end | |
5974 | end) | |
5975 | ||
5976 | NewCMD("Btools", "bto", "Gives a player building tools",function(msg) | |
5977 | local plrs = GetPlayers(msg) | |
5978 | for _,plr in next,plrs do | |
5979 | local x = game:GetService("InsertService"):LoadAsset(73089166) x.Parent =game.Players.LocalPlayer.Backpack | |
5980 | local x = game:GetService("InsertService"):LoadAsset(73089204) x.Parent =game.Players.LocalPlayer.Backpack | |
5981 | local x = game:GetService("InsertService"):LoadAsset(73089190) x.Parent =game.Players.LocalPlayer.Backpack | |
5982 | local x = game:GetService("InsertService"):LoadAsset(58880579) x.Parent =game.Players.LocalPlayer.Backpack | |
5983 | local x = game:GetService("InsertService"):LoadAsset(60791062) x.Parent =game.Players.LocalPlayer.Backpack | |
5984 | local x = game:GetService("InsertService"):LoadAsset(73089239) x.Parent =game.Players.LocalPlayer.Backpack | |
5985 | ChatBubble.Create("Given Btools") | |
5986 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2}) | |
5987 | end | |
5988 | end) | |
5989 | ||
5990 | NewCMD("Knife", "kni", "Gives a player a knife",function(msg) | |
5991 | local plrs = GetPlayers(msg) | |
5992 | for _,plr in next,plrs do | |
5993 | ChatBubble.Create("Given Knife") | |
5994 | local x = game:GetService("InsertService"):LoadAsset(170897263) x.Parent =game.Players.LocalPlayer.Backpack | |
5995 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2}) | |
5996 | end | |
5997 | end) | |
5998 | ||
5999 | NewCMD("Darksteel", "drks", "Gives a player the darksteel katana",function(msg) | |
6000 | local plrs = GetPlayers(msg) | |
6001 | for _,plr in next,plrs do | |
6002 | local x = game:GetService("InsertService"):LoadAsset(86494893) x.Parent =game.Players.LocalPlayer.Backpack | |
6003 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2}) | |
6004 | end | |
6005 | end) | |
6006 | ||
6007 | NewCMD("Archer", "arch", "Gives a player ALOT of bows",function(msg) | |
6008 | local plrs = GetPlayers(msg) | |
6009 | for _,plr in next,plrs do | |
6010 | local x = game:GetService("InsertService"):LoadAsset(92142841) x.Parent =game.Players.LocalPlayer.Backpack | |
6011 | local x = game:GetService("InsertService"):LoadAsset(110892267) x.Parent =game.Players.LocalPlayer.Backpack | |
6012 | local x = game:GetService("InsertService"):LoadAsset(160198008) x.Parent =game.Players.LocalPlayer.Backpack | |
6013 | local x = game:GetService("InsertService"):LoadAsset(204485737) x.Parent =game.Players.LocalPlayer.Backpack | |
6014 | local x = game:GetService("InsertService"):LoadAsset(223785350) x.Parent =game.Players.LocalPlayer.Backpack | |
6015 | local x = game:GetService("InsertService"):LoadAsset(287425246) x.Parent =game.Players.LocalPlayer.Backpack | |
6016 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2}) | |
6017 | end | |
6018 | end) | |
6019 | ||
6020 | NewCMD("Swords", "swor", "Gives a player ALOT of swords",function(msg) | |
6021 | local plrs = GetPlayers(msg) | |
6022 | for _,plr in next,plrs do | |
6023 | local x = game:GetService("InsertService"):LoadAsset(159229806) x.Parent = game.Players.LocalPlayer.Backpack | |
6024 | local x = game:GetService("InsertService"):LoadAsset(101191388) x.Parent = game.Players.LocalPlayer.Backpack | |
6025 | local x = game:GetService("InsertService"):LoadAsset(77443491) x.Parent = game.Players.LocalPlayer.Backpack | |
6026 | local x = game:GetService("InsertService"):LoadAsset(77443461) x.Parent = game.Players.LocalPlayer.Backpack | |
6027 | local x = game:GetService("InsertService"):LoadAsset(108149175) x.Parent = game.Players.LocalPlayer.Backpack | |
6028 | local x = game:GetService("InsertService"):LoadAsset(53623248) x.Parent = game.Players.LocalPlayer.Backpack | |
6029 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2}) | |
6030 | end | |
6031 | end) | |
6032 | ||
6033 | NewCMD("Fire,Sparkles,ForceField", "fsf", "Gives a player Fire+Sparkles+FF",function(msg) | |
6034 | local plrs = GetPlayers(msg) | |
6035 | for _,plr in next,plrs do | |
6036 | local F = Instance.new("Sparkles") | |
6037 | F.Parent = plr.Character.Torso | |
6038 | local F = Instance.new("Fire") | |
6039 | F.Parent = plr.Character.Torso | |
6040 | local F = Instance.new("ForceField") | |
6041 | F.Parent = plr.Character | |
6042 | ||
6043 | end | |
6044 | end) | |
6045 | ||
6046 | NewCMD("ForceField", "ff", "Gives a player a ForceField",function(msg) | |
6047 | local plrs = GetPlayers(msg) | |
6048 | for _,plr in next,plrs do | |
6049 | local F = Instance.new("ForceField") | |
6050 | F.Parent = plr.Character | |
6051 | ChatBubble.Create("Given FF!") | |
6052 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Teal"), float_duration = 0.2}) | |
6053 | end | |
6054 | end) | |
6055 | ||
6056 | NewCMD("RemoveFire", "rfia", "Removes fire from a player",function(msg) | |
6057 | local plrs = GetPlayers(msg) | |
6058 | for _,plr in next,plrs do | |
6059 | for _,Child in pairs(plr["Character"].Torso:GetChildren()) do | |
6060 | if Child:IsA("Fire") then | |
6061 | Child:Destroy() | |
6062 | end | |
6063 | end | |
6064 | end | |
6065 | end) | |
6066 | ||
6067 | NewCMD("Stop Messages", "sm", "Clears all messages in the workspace",function() | |
6068 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
6069 | if Child:IsA("Message") then | |
6070 | Child:Destroy() | |
6071 | end | |
6072 | end | |
6073 | end) | |
6074 | ||
6075 | NewCMD("Always Stop Messages", "asm", "Always Clears all messages in the workspace",function() | |
6076 | asm = true | |
6077 | end) | |
6078 | ||
6079 | NewCMD("Never Stop Messages", "nsm", "never Clears all messages in the workspace",function() | |
6080 | asm = false | |
6081 | end) | |
6082 | ||
6083 | NewCMD("RemoveSparkles", "rsp", "Removes Sparkles From A Player",function(msg) | |
6084 | local plrs = GetPlayers(msg) | |
6085 | for _,plr in next,plrs do | |
6086 | for _,Child in pairs(plr["Character"].Torso:GetChildren()) do | |
6087 | if Child:IsA("Sparkles") then | |
6088 | Child:Destroy() | |
6089 | end | |
6090 | end | |
6091 | end | |
6092 | end) | |
6093 | ||
6094 | NewCMD("RemoveForceField", "rff", "Removes ff from a player",function(msg) | |
6095 | local plrs = GetPlayers(msg) | |
6096 | for _,plr in next,plrs do | |
6097 | for _,Child in pairs(plr["Character"]:GetChildren()) do | |
6098 | if Child:IsA("ForceField") then | |
6099 | Child:Destroy() | |
6100 | end | |
6101 | end | |
6102 | end | |
6103 | end) | |
6104 | ||
6105 | NewCMD("God", "go", "Makes a player god",function(msg) | |
6106 | local plrs = GetPlayers(msg) | |
6107 | for _,plr in next,plrs do | |
6108 | plr.Character.Humanoid.MaxHealth = math.huge | |
6109 | plr.Character.Humanoid.Health = math.huge | |
6110 | ChatBubble.Create("Goded Player!") | |
6111 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2}) | |
6112 | end | |
6113 | end) | |
6114 | ||
6115 | NewCMD("Remove god", "rgo", "Remove god from a player",function(msg) | |
6116 | local plrs = GetPlayers(msg) | |
6117 | for _,plr in next,plrs do | |
6118 | plr.Character.Humanoid.MaxHealth = 100 | |
6119 | plr.Character.Humanoid.Health = 100 | |
6120 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2}) | |
6121 | end | |
6122 | end) | |
6123 | ||
6124 | NewCMD("Red Outline", "OlRed", "Makes the tablets have a red Outline",function() | |
6125 | OutlineColor = BrickColor.new("Really red") | |
6126 | end) | |
6127 | ||
6128 | NewCMD("Blue Outline", "OlBlue", "Makes the tablets have a blue Outline",function() | |
6129 | OutlineColor = BrickColor.new("Really blue") | |
6130 | end) | |
6131 | ||
6132 | NewCMD("Black Outline", "OlBlack", "Makes the tablets have a black Outline",function() | |
6133 | OutlineColor = BrickColor.new("Really black") | |
6134 | end) | |
6135 | ||
6136 | NewCMD("Swegify", "sweg", "Makes a player sweg",function(msg) | |
6137 | local plrs = GetPlayers(msg) | |
6138 | for _,plr in next,plrs do | |
6139 | plr.Character.BodyColors:remove() | |
6140 | plr.Character.Humanoid.MaxHealth = 100000 | |
6141 | plr.Character.Humanoid.Health = 100000 | |
6142 | plr.Character["Head"].BrickColor = BrickColor.new("Institutional White") | |
6143 | plr.Character["Torso"].BrickColor = BrickColor.new("Institutional White") | |
6144 | plr.Character["Left Leg"].BrickColor = BrickColor.new("Institutional White") | |
6145 | plr.Character["Left Arm"].BrickColor = BrickColor.new("Institutional White") | |
6146 | plr.Character["Right Arm"].BrickColor = BrickColor.new("Institutional White") | |
6147 | plr.Character["Right Leg"].BrickColor = BrickColor.new("Institutional White") | |
6148 | if plr.Character.Shirt then | |
6149 | plr.Character.Shirt:remove() | |
6150 | end | |
6151 | if plr.Character.Pants then | |
6152 | plr.Character.Pants:remove() | |
6153 | end | |
6154 | local S = Instance.new("Shirt") | |
6155 | S.Parent = plr.Character | |
6156 | S.ShirtTemplate = "http://www.roblox.com/asset/?id=156250287" | |
6157 | local S = Instance.new("Pants") | |
6158 | S.Parent = plr.Character | |
6159 | S.ShirtTemplate = "http://www.roblox.com/asset/?id=120713224" | |
6160 | ||
6161 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new(""), float_duration = 0.2}) | |
6162 | end | |
6163 | end) | |
6164 | ||
6165 | NewCMD("Playerinfo", "pin", "Shows a players information",function(msg) | |
6166 | local plrs = GetPlayers(msg) | |
6167 | for _,plr in next,plrs do | |
6168 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Forest green"), float_duration = 0.2}) | |
6169 | Tablet("Age: "..plr.AccountAge, Colors.Magenta) | |
6170 | Tablet("Membership: "..plr.MembershipType.Name, Colors.Magenta) | |
6171 | Tablet("Player: "..plr.Name, Colors.Magenta) | |
6172 | Tablet("Id: "..plr.userId, Colors.Magenta) | |
6173 | Tablet("Camera Mode: "..plr.CameraMode.Name, Colors.Magenta) | |
6174 | Tablet("This is "..plr.."'s info", Colors.Magenta) | |
6175 | ChatBubble.Create("Found info!") | |
6176 | end | |
6177 | end) | |
6178 | ||
6179 | NewCMD("Remove music", "rm", "remove music",function() | |
6180 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
6181 | if Child:IsA("Sound") then | |
6182 | Child:Stop() | |
6183 | end | |
6184 | end | |
6185 | ||
6186 | end) | |
6187 | ||
6188 | Services = { | |
6189 | game:GetService("Workspace"), | |
6190 | game:GetService("Players"), | |
6191 | game:GetService("Lighting"), | |
6192 | game:GetService("StarterPack"), | |
6193 | game:GetService("StarterGui"), | |
6194 | game:GetService("Teams"), | |
6195 | game:GetService("SoundService"), | |
6196 | game:GetService("Debris"), | |
6197 | game:GetService("InsertService"), | |
6198 | game:GetService("RunService"), | |
6199 | game:GetService("Chat"), | |
6200 | game:GetService("TeleportService"), | |
6201 | game:GetService("Geometry"), | |
6202 | game:GetService("MarketplaceService"), | |
6203 | game:GetService("BadgeService"), | |
6204 | game:GetService("NetworkClient"), | |
6205 | game:GetService("FriendService"), | |
6206 | } | |
6207 | ||
6208 | function Explore(Item) | |
6209 | Dismiss() | |
6210 | if(Item==nil)then | |
6211 | for _,v in pairs(Services)do | |
6212 | Tablet(tostring(v),Colors.Black,function() wait() Explore(v) end) | |
6213 | end; | |
6214 | else | |
6215 | f={ | |
6216 | ['View children']=function() | |
6217 | Dismiss() | |
6218 | for _,v in pairs(Item:children())do | |
6219 | Tablet(v.Name,Colors.Black,function() | |
6220 | wait() | |
6221 | Explore(v) | |
6222 | end); | |
6223 | end; | |
6224 | end; | |
6225 | ['View parent']=function() | |
6226 | wait() | |
6227 | Explore(Item.Parent) | |
6228 | end; | |
6229 | ['Destroy']=function() | |
6230 | Item:Destroy(); | |
6231 | Explore(Item.Parent); | |
6232 | end; | |
6233 | ['Clear']=function() | |
6234 | Item:ClearAllChildren() | |
6235 | end; | |
6236 | ['Clone']=function() | |
6237 | pcall(function() | |
6238 | cloneableObj = Item:clone() | |
6239 | end) | |
6240 | end; | |
6241 | ['Remove']=function() | |
6242 | Item:remove() | |
6243 | end; | |
6244 | ['Stop']=function() | |
6245 | Item:Stop() | |
6246 | end; | |
6247 | ['Play']=function() | |
6248 | Item:Play() | |
6249 | end; | |
6250 | ['Shiny']=function() | |
6251 | Item.Reflectance = 1 | |
6252 | end; | |
6253 | ['Un-Shiny']=function() | |
6254 | Item.Reflectance = 0 | |
6255 | end; | |
6256 | ['Transparent']=function() | |
6257 | Item.Transparency = 1 | |
6258 | end; | |
6259 | ['Opaque']=function() | |
6260 | Item.Transparency = 0 | |
6261 | end; | |
6262 | ['Paste']=function() | |
6263 | if cloneableObj then | |
6264 | cloneableObj.Parent = Item | |
6265 | end | |
6266 | end; | |
6267 | }; | |
6268 | for i,v in pairs(f)do | |
6269 | Tablet(tostring(i),Colors.Red,v); | |
6270 | end; | |
6271 | Tablet('Item Name: \''..tostring(Item.Name)..'\'',Colors.Blue,nil); | |
6272 | Tablet('Class: \''..tostring(Item.ClassName)..'\'',Colors.Blue,nil); | |
6273 | if cloneableObj then | |
6274 | Tablet('Currently Cloning: \''..tostring(cloneableObj.Name)..'\'',Colors.Blue,nil); | |
6275 | end | |
6276 | end; | |
6277 | end; | |
6278 | ||
6279 | NewCMD("Explore","expl","Explore the game", | |
6280 | function() | |
6281 | Explore() | |
6282 | end | |
6283 | ) | |
6284 | ||
6285 | ||
6286 | ||
6287 | function Fus() | |
6288 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
6289 | if Child:IsA("Sound") then | |
6290 | Child:Destroy() | |
6291 | end | |
6292 | end | |
6293 | local S = Instance.new("Sound") | |
6294 | S = game.Workspace.Sound | |
6295 | S:Stop() | |
6296 | S.SoundId = "http://www.roblox.com/asset/?id=130776150" | |
6297 | Tablet("Play",Colors.Black,S:Play()) | |
6298 | end | |
6299 | function Hun() | |
6300 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
6301 | if Child:IsA("Sound") then | |
6302 | Child:Destroy() | |
6303 | end | |
6304 | end | |
6305 | local S = Instance.new("Sound") | |
6306 | S.Parent = game.Workspace | |
6307 | S:Stop() | |
6308 | S.SoundId = "http://www.roblox.com/asset/?id=142397652" | |
6309 | Tablet("Play",Colors.Black,S:Play()) | |
6310 | end | |
6311 | function Ill() | |
6312 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
6313 | if Child:IsA("Sound") then | |
6314 | Child:Destroy() | |
6315 | end | |
6316 | end | |
6317 | local S = Instance.new("Sound") | |
6318 | S.Parent = game.Workspace | |
6319 | S:Stop() | |
6320 | S.SoundId = "http://www.roblox.com/asset/?id=188797309" | |
6321 | Tablet("Play",Colors.Black,S:Play()) | |
6322 | end | |
6323 | function Bel() | |
6324 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
6325 | if Child:IsA("Sound") then | |
6326 | Child:Destroy() | |
6327 | end | |
6328 | end | |
6329 | local S = Instance.new("Sound") | |
6330 | S.Parent = game.Workspace | |
6331 | S:Stop() | |
6332 | S.SoundId = "http://www.roblox.com/asset/?id=165432090" | |
6333 | Tablet("Play",Colors.Black,S:Play()) | |
6334 | end | |
6335 | function Dub() | |
6336 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
6337 | if Child:IsA("Sound") then | |
6338 | Child:Destroy() | |
6339 | end | |
6340 | end | |
6341 | local S = Instance.new("Sound") | |
6342 | S.Parent = game.Workspace | |
6343 | S:Stop() | |
6344 | S.SoundId = "http://www.roblox.com/asset/?id=152745539" | |
6345 | Tablet("Play",Colors.Black,S:Play()) | |
6346 | end | |
6347 | function Can() | |
6348 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
6349 | if Child:IsA("Sound") then | |
6350 | Child:Destroy() | |
6351 | end | |
6352 | end | |
6353 | local S = Instance.new("Sound") | |
6354 | S.Parent = game.Workspace | |
6355 | S:Stop() | |
6356 | S.SoundId = "http://www.roblox.com/asset/?id=222095512" | |
6357 | Tablet("Play",Colors.Black,S:Play()) | |
6358 | end | |
6359 | ||
6360 | function Music() | |
6361 | Tablet("Fus Ro Dah!",Colors.Black,Fus()) | |
6362 | Tablet("Hunger Games",Colors.Black,Hun()) | |
6363 | Tablet("Illuminati",Colors.Black,Ill()) | |
6364 | Tablet("I Believe i can fly",Colors.Black,Bel()) | |
6365 | Tablet("Dubstep Remix!",Colors.Black,Dub()) | |
6366 | Tablet("Candy Land!",Colors.Black,Can()) | |
6367 | end | |
6368 | ||
6369 | ||
6370 | ||
6371 | ||
6372 | NewCMD("Music List","Ml","Shows The Music List", | |
6373 | function() | |
6374 | Tablet("Fus Ro Dah!",Colors.Black,Fus()) | |
6375 | Tablet("Hunger Games",Colors.Black,Hun()) | |
6376 | Tablet("Illuminati",Colors.Black,Ill()) | |
6377 | Tablet("I Believe i can fly",Colors.Black,Bel()) | |
6378 | Tablet("Dubstep Remix!",Colors.Black,Dub()) | |
6379 | Tablet("Candy Land!",Colors.Black,Can()) | |
6380 | end | |
6381 | ) | |
6382 | ||
6383 | ||
6384 | ||
6385 | ||
6386 | ||
6387 | ||
6388 | ||
6389 | ||
6390 | ||
6391 | ||
6392 | ||
6393 | ||
6394 | NewCMD("Doge", "doge", "Dogeify's the player", function(msg) | |
6395 | local plrs = GetPlayers(msg) | |
6396 | for _,plr in next,plrs do | |
6397 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2}) | |
6398 | local function QuaternionFromCFrame(cf) | |
6399 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() | |
6400 | local trace = m00 + m11 + m22 | |
6401 | if trace > 0 then | |
6402 | local s = math.sqrt(1 + trace) | |
6403 | local recip = 0.5/s | |
6404 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 | |
6405 | else | |
6406 | local i = 0 | |
6407 | if m11 > m00 then | |
6408 | i = 1 | |
6409 | end | |
6410 | if m22 > (i == 0 and m00 or m11) then | |
6411 | i = 2 | |
6412 | end | |
6413 | if i == 0 then | |
6414 | local s = math.sqrt(m00-m11-m22+1) | |
6415 | local recip = 0.5/s | |
6416 | return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip | |
6417 | elseif i == 1 then | |
6418 | local s = math.sqrt(m11-m22-m00+1) | |
6419 | local recip = 0.5/s | |
6420 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip | |
6421 | elseif i == 2 then | |
6422 | local s = math.sqrt(m22-m00-m11+1) | |
6423 | local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip | |
6424 | end | |
6425 | end | |
6426 | end | |
6427 | local function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
6428 | local xs, ys, zs = x + x, y + y, z + z | |
6429 | local wx, wy, wz = w*xs, w*ys, w*zs | |
6430 | local xx = x*xs | |
6431 | local xy = x*ys | |
6432 | local xz = x*zs | |
6433 | local yy = y*ys | |
6434 | local yz = y*zs | |
6435 | local zz = z*zs | |
6436 | return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) | |
6437 | end | |
6438 | local function QuaternionSlerp(a, b, t) | |
6439 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] | |
6440 | local startInterp, finishInterp; | |
6441 | if cosTheta >= 0.0001 then | |
6442 | if (1 - cosTheta) > 0.0001 then | |
6443 | local theta = math.acos(cosTheta) | |
6444 | local invSinTheta = 1/math.sin(theta) | |
6445 | startInterp = math.sin((1-t)*theta)*invSinTheta | |
6446 | finishInterp = math.sin(t*theta)*invSinTheta | |
6447 | else | |
6448 | startInterp = 1-t | |
6449 | finishInterp = t | |
6450 | end | |
6451 | else | |
6452 | if (1+cosTheta) > 0.0001 then | |
6453 | local theta = math.acos(-cosTheta) | |
6454 | local invSinTheta = 1/math.sin(theta) | |
6455 | startInterp = math.sin((t-1)*theta)*invSinTheta | |
6456 | finishInterp = math.sin(t*theta)*invSinTheta | |
6457 | else | |
6458 | startInterp = t-1 | |
6459 | finishInterp = t | |
6460 | end | |
6461 | end | |
6462 | return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp | |
6463 | end | |
6464 | function clerp(a,b,t) | |
6465 | local qa = {QuaternionFromCFrame(a)} | |
6466 | local qb = {QuaternionFromCFrame(b)} | |
6467 | local ax, ay, az = a.x, a.y, a.z | |
6468 | local bx, by, bz = b.x, b.y, b.z | |
6469 | local _t = 1-t | |
6470 | return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t)) | |
6471 | end | |
6472 | ||
6473 | do --the animating | |
6474 | ||
6475 | char = plr.Character | |
6476 | mouse = plr:GetMouse() | |
6477 | humanoid = char:findFirstChild("Humanoid") | |
6478 | torso = char:findFirstChild("Torso") | |
6479 | head = char.Head | |
6480 | ra = char:findFirstChild("Right Arm") | |
6481 | la = char:findFirstChild("Left Arm") | |
6482 | rl = char:findFirstChild("Right Leg") | |
6483 | ll = char:findFirstChild("Left Leg") | |
6484 | rs = torso:findFirstChild("Right Shoulder") | |
6485 | ls = torso:findFirstChild("Left Shoulder") | |
6486 | rh = torso:findFirstChild("Right Hip") | |
6487 | lh = torso:findFirstChild("Left Hip") | |
6488 | neck = torso:findFirstChild("Neck") | |
6489 | rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint") | |
6490 | anim = char:findFirstChild("Animate") | |
6491 | rootpart = char:findFirstChild("HumanoidRootPart") | |
6492 | camera = workspace.CurrentCamera | |
6493 | if anim then | |
6494 | anim:Destroy() | |
6495 | end | |
6496 | ||
6497 | ||
6498 | local rm = Instance.new("Motor", torso) | |
6499 | rm.C0 = CFrame.new(1.5, 0.5, 0) | |
6500 | rm.C1 = CFrame.new(0, 0.5, 0) | |
6501 | rm.Part0 = torso | |
6502 | rm.Part1 = ra | |
6503 | local lm = Instance.new("Motor", torso) | |
6504 | lm.C0 = CFrame.new(-1.5, 0.5, 0) | |
6505 | lm.C1 = CFrame.new(0, 0.5, 0) | |
6506 | lm.Part0 = torso | |
6507 | lm.Part1 = la | |
6508 | ||
6509 | local rlegm = Instance.new("Motor", torso) | |
6510 | rlegm.C0 = CFrame.new(0.5, -1, 0) | |
6511 | rlegm.C1 = CFrame.new(0, 1, 0) | |
6512 | rlegm.Part0 = torso | |
6513 | rlegm.Part1 = rl | |
6514 | local llegm = Instance.new("Motor", torso) | |
6515 | llegm.C0 = CFrame.new(-0.5, -1, 0) | |
6516 | llegm.C1 = CFrame.new(0, 1, 0) | |
6517 | llegm.Part0 = torso | |
6518 | llegm.Part1 = ll | |
6519 | ||
6520 | neck.C0 = CFrame.new(0, 1, 0) | |
6521 | neck.C1 = CFrame.new(0, -0.5, 0) | |
6522 | ||
6523 | ||
6524 | rj.C0 = CFrame.new() | |
6525 | rj.C1 = CFrame.new() | |
6526 | ||
6527 | ||
6528 | local sound = Instance.new("Sound", head) | |
6529 | sound.SoundId = "http://www.roblox.com/asset/?id=130797915" | |
6530 | sound.Volume = 0.8 | |
6531 | sound.Looped = true | |
6532 | ||
6533 | for i,v in pairs(char:children()) do | |
6534 | if v:IsA("Hat") then | |
6535 | v:Destroy() | |
6536 | end | |
6537 | end | |
6538 | ||
6539 | ||
6540 | --look of the fox here | |
6541 | game:service'InsertService':LoadAsset(151784320):children()[1].Parent = char | |
6542 | Instance.new("PointLight", head).Range = 10 | |
6543 | ||
6544 | ||
6545 | ||
6546 | ||
6547 | local speed = 0.3 | |
6548 | local angle = 0 | |
6549 | local sitting = false | |
6550 | local humanwalk = false | |
6551 | local anglespeed = 1 | |
6552 | rsc0 = rm.C0 | |
6553 | lsc0 = lm.C0 | |
6554 | llc0 = llegm.C0 | |
6555 | rlc0 = rlegm.C0 | |
6556 | neckc0 = neck.C0 | |
6557 | ||
6558 | local controllerService = game:GetService("ControllerService") | |
6559 | local controller = controllerService:GetChildren()[1] | |
6560 | ||
6561 | controller.Parent = nil | |
6562 | ||
6563 | Instance.new("HumanoidController", game:service'ControllerService') | |
6564 | Instance.new("SkateboardController", game:service'ControllerService') | |
6565 | Instance.new("VehicleController", game:service'ControllerService') | |
6566 | local controller = controllerService:GetChildren()[1] | |
6567 | mouse.KeyDown:connect(function(k) | |
6568 | if k == "q" then | |
6569 | humanwalk = not humanwalk | |
6570 | end | |
6571 | if k == "z" then | |
6572 | if not sound.IsPlaying then | |
6573 | sound:stop() | |
6574 | sound.SoundId = "http://www.roblox.com/asset/?id=130802245" | |
6575 | wait() | |
6576 | sound:play() | |
6577 | end | |
6578 | end | |
6579 | if k == "x" then | |
6580 | if not sound.IsPlaying then | |
6581 | sound:stop() | |
6582 | sound.SoundId = "http://www.roblox.com/asset/?id=130797915" | |
6583 | wait() | |
6584 | sound:play() | |
6585 | end | |
6586 | end | |
6587 | if k == "c" then | |
6588 | if not sound.IsPlaying then | |
6589 | sound:stop() | |
6590 | sound.SoundId = "http://www.roblox.com/asset/?id=149713968" | |
6591 | wait() | |
6592 | sound:play() | |
6593 | end | |
6594 | end | |
6595 | if string.byte(k) == 48 then | |
6596 | humanoid.WalkSpeed = 34 | |
6597 | end | |
6598 | ||
6599 | end) | |
6600 | mouse.KeyUp:connect(function(k) | |
6601 | ||
6602 | if string.byte(k) == 48 then | |
6603 | humanoid.WalkSpeed = 16 | |
6604 | end | |
6605 | ||
6606 | end) | |
6607 | ||
6608 | ||
6609 | ||
6610 | while wait() do | |
6611 | angle = (angle % 100) + anglespeed/10 | |
6612 | mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10)) | |
6613 | local rscf = rsc0 | |
6614 | local lscf = lsc0 | |
6615 | local rlcf = rlc0 | |
6616 | local llcf = llc0 | |
6617 | local rjcf = CFrame.new() | |
6618 | local ncf = neckc0 | |
6619 | local rayz = Ray.new(rootpart.Position, Vector3.new(0, -6, 0)) | |
6620 | local hitz, enz = workspace:findPartOnRay(rayz, char) | |
6621 | if not hitz then | |
6622 | if sound.IsPlaying then | |
6623 | sound:stop() | |
6624 | end | |
6625 | ||
6626 | if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude > 2 then | |
6627 | ||
6628 | ncf = neckc0 * CFrame.Angles(math.pi/5, 0, 0) | |
6629 | rjcf = CFrame.new() * CFrame.Angles(-math.pi/5, math.sin(angle)*0.05, 0) | |
6630 | rscf = rsc0 * CFrame.Angles(math.pi/1.7+math.sin(angle)*0.1, 0, 0) | |
6631 | lscf = lsc0 * CFrame.Angles(math.pi/1.7+math.sin(-angle)*0.1, 0, 0) | |
6632 | rlcf = rlc0 * CFrame.Angles(-math.pi/10+math.sin(-angle)*0.3, 0, 0) | |
6633 | llcf = llc0 * CFrame.Angles(-math.pi/10+math.sin(angle)*0.3, 0, 0) | |
6634 | ||
6635 | else | |
6636 | ||
6637 | ncf = neckc0 * CFrame.Angles(math.pi/14, 0, 0) | |
6638 | rjcf = CFrame.new() * CFrame.Angles(-math.pi/18, math.sin(angle)*0.05, 0) | |
6639 | rscf = rsc0 * CFrame.Angles(-math.pi/10+math.sin(angle)*0.2, 0, 0) | |
6640 | lscf = lsc0 * CFrame.Angles(-math.pi/10+math.sin(-angle)*0.2, 0, 0) | |
6641 | rlcf = rlc0 * CFrame.new(0, 0.7, -0.5) CFrame.Angles(-math.pi/14, 0, 0) | |
6642 | llcf = llc0 * CFrame.Angles(-math.pi/20, 0, 0) | |
6643 | ||
6644 | end | |
6645 | elseif humanoid.Sit then | |
6646 | if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130797915" then | |
6647 | anglespeed = 6 | |
6648 | ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0) | |
6649 | rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0) | |
6650 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
6651 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
6652 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
6653 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
6654 | elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=135570347" then | |
6655 | anglespeed = 4 | |
6656 | ncf = neckc0 * CFrame.Angles(math.pi/5-math.abs(math.sin(angle))*0.3, 0, 0) | |
6657 | rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0) | |
6658 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
6659 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
6660 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
6661 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
6662 | elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149713968" then | |
6663 | anglespeed = 2 | |
6664 | ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08) | |
6665 | rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0) | |
6666 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
6667 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
6668 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
6669 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
6670 | else | |
6671 | anglespeed = 1/2 | |
6672 | ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08) | |
6673 | rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0) | |
6674 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
6675 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
6676 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
6677 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
6678 | end | |
6679 | elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then | |
6680 | if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130797915" then | |
6681 | anglespeed = 6 | |
6682 | ncf = neckc0 * CFrame.Angles(math.pi/10-math.sin(angle)*0.07, 0, 0) | |
6683 | rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/10, math.sin(angle)*0.001, 0) | |
6684 | rscf = rsc0 * CFrame.Angles(math.pi/1+math.sin(angle)*0.5, 0, 0) | |
6685 | lscf = lsc0 * CFrame.Angles(math.pi/1+math.sin(angle)*0.5, 0, 0) | |
6686 | rlcf = rlc0 * CFrame.Angles(math.pi/10, math.sin(angle)*0.08, math.rad(6.5)) | |
6687 | llcf = llc0 * CFrame.Angles(math.pi/10, -math.sin(angle)*0.08, -math.rad(6.5)) | |
6688 | elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149713968" then | |
6689 | anglespeed = 2 | |
6690 | ncf = neckc0 * CFrame.Angles(math.pi/10-math.abs(math.sin(angle))*0.3, 0, 0) | |
6691 | rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/20, math.sin(angle)*0.001, 0) | |
6692 | rscf = rsc0 * CFrame.Angles(math.pi/2+math.abs(math.sin(angle)*1), 0, 0) | |
6693 | lscf = lsc0 * CFrame.Angles(math.pi/2+math.abs(math.sin(angle)*1), 0, 0) | |
6694 | rlcf = rlc0 * CFrame.Angles(math.pi/20, math.sin(angle)*0.08, math.rad(2.5)) | |
6695 | llcf = llc0 * CFrame.Angles(math.pi/20, -math.sin(angle)*0.08, -math.rad(2.5)) | |
6696 | elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130802245" then | |
6697 | anglespeed = 3 | |
6698 | ncf = neckc0 * CFrame.Angles(math.sin(angle)*0.07, math.rad(30), 0) | |
6699 | rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0) | |
6700 | rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.05, 0, 0) | |
6701 | lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.05, 0, 0) | |
6702 | rlcf = rlc0 * CFrame.new(0, -0.1 + math.abs(mvmnt)*0.1, -0.1) * CFrame.Angles(0, math.rad(5), math.rad(5)) | |
6703 | llcf = llc0 * CFrame.Angles(0, math.rad(2.5), math.rad(1)) | |
6704 | else | |
6705 | if humanwalk then | |
6706 | anglespeed = 1/4 | |
6707 | ncf = neckc0 * CFrame.Angles(-math.sin(angle)*0.07, 0, 0) | |
6708 | rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0) | |
6709 | rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.1, 0, 0) | |
6710 | lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.1, 0, 0) | |
6711 | rlcf = rlc0 * CFrame.Angles(0, math.sin(angle)*0.08, math.rad(2.5)) | |
6712 | llcf = llc0 * CFrame.Angles(0, -math.sin(angle)*0.08, -math.rad(2.5)) | |
6713 | else | |
6714 | anglespeed = 1/2 | |
6715 | ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08) | |
6716 | rjcf = CFrame.new(0, -2, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0) | |
6717 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
6718 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
6719 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
6720 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
6721 | end | |
6722 | end | |
6723 | elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 20 then | |
6724 | if sound.IsPlaying then | |
6725 | sound:stop() | |
6726 | end | |
6727 | if humanwalk then | |
6728 | anglespeed = 4 | |
6729 | ncf = neckc0 * CFrame.Angles(math.pi/24, mvmnt*.02, 0) | |
6730 | rjcf = CFrame.new(0, math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/24, -mvmnt*.02, 0) | |
6731 | rscf = rsc0 * CFrame.Angles(math.sin(angle)*1.25, 0, -math.abs(mvmnt)*0.02) | |
6732 | lscf = lsc0 * CFrame.Angles(math.sin(-angle)*1.25, 0, math.abs(mvmnt)*0.02) | |
6733 | rlcf = rlc0 * CFrame.Angles(math.sin(-angle)*1, 0, math.rad(.5)) | |
6734 | llcf = llc0 * CFrame.Angles(math.sin(angle)*1, 0, -math.rad(.5)) | |
6735 | else | |
6736 | anglespeed = 4 | |
6737 | ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9, 0, 0) | |
6738 | rjcf = CFrame.new(0, -1.5+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9, math.sin(mvmnt/2)*0.05, 0) | |
6739 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.4+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(angle)*0.7, 0, math.rad(5)) | |
6740 | lscf = lsc0 * CFrame.new(.45, 0.2, .1-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(-angle)*0.7, 0, -math.rad(5)) | |
6741 | rlcf = rlc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*0.6, 0, math.abs(mvmnt)*0.025) | |
6742 | llcf = llc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(angle)*.6, 0, -math.abs(mvmnt)*0.025) | |
6743 | end | |
6744 | elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then | |
6745 | if sound.IsPlaying then | |
6746 | sound:stop() | |
6747 | end | |
6748 | if humanwalk then | |
6749 | anglespeed = 5 | |
6750 | ncf = neckc0 * CFrame.Angles(math.pi/20, math.sin(angle)*.04, 0) | |
6751 | rjcf = CFrame.new(0, -.4 + math.abs(mvmnt)*0.25, 0) * CFrame.Angles(-math.pi/20, -math.sin(angle)*.08, 0) | |
6752 | rscf = rsc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/18+math.sin(angle)*1.5, 0, -math.abs(mvmnt)*0.02) | |
6753 | lscf = lsc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/18+math.sin(-angle)*1.5, 0, math.abs(mvmnt)*0.02) | |
6754 | rlcf = rlc0 * CFrame.new(0, 0, -.6+math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(-angle)*1.3, 0, math.rad(.5)) | |
6755 | llcf = llc0 * CFrame.new(0, 0, -math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(angle)*1.3, 0, -math.rad(.5)) | |
6756 | else | |
6757 | anglespeed = 5.5 | |
6758 | ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9+math.sin(mvmnt/2)*0.05, 0, 0) | |
6759 | rjcf = CFrame.new(0, -1.3+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9+math.abs(mvmnt/2)*0.1, 0, 0) | |
6760 | rscf = rsc0 * CFrame.new(-1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, math.rad(5)) | |
6761 | lscf = lsc0 * CFrame.new(1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, -math.rad(5)) | |
6762 | rlcf = rlc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, math.abs(mvmnt)*0.025) | |
6763 | llcf = llc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, -math.abs(mvmnt)*0.025) | |
6764 | end | |
6765 | end | |
6766 | ||
6767 | rm.C0 = clerp(rm.C0,rscf,speed) | |
6768 | lm.C0 = clerp(lm.C0,lscf,speed) | |
6769 | rj.C0 = clerp(rj.C0,rjcf,speed) | |
6770 | neck.C0 = clerp(neck.C0,ncf,speed) | |
6771 | rlegm.C0 = clerp(rlegm.C0,rlcf,speed) | |
6772 | llegm.C0 = clerp(llegm.C0,llcf,speed) | |
6773 | end | |
6774 | ||
6775 | ||
6776 | end | |
6777 | end | |
6778 | end) | |
6779 | NewCMD("LoopKill", "lk", "LoopKills the player", function(msg) | |
6780 | local plrs = GetPlayers(msg) | |
6781 | for _,plr in next,plrs do | |
6782 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2}) | |
6783 | while true do | |
6784 | wait(1) | |
6785 | plr.Character:BreakJoints() | |
6786 | end | |
6787 | end | |
6788 | end) | |
6789 | --NewCMD("Banlist (By runtoheven, No stealing credit)", "bl", "Shows banned players (By runtoheven, No stealing credit)", | |
6790 | --) | |
6791 | ||
6792 | NewCMD("Useless Cmd", "uc", "The most useless cmd ever made", function(msg) | |
6793 | Tablet("We are sorry, but this command is useless. Please try again.", Colors.Magenta) | |
6794 | end) | |
6795 | NewCMD("Cr".."edits ", "cr".."edit", "Cre".."dits", function(msg) | |
6796 | Tablet("C".."redits", Colors.Green) | |
6797 | Tablet("Mad".."e By P".."oin".."tCoded and ng".."uye".."njimbo", Colors.Blue) | |
6798 | Tablet("Cr".."edits to the Plu".."tonium cre".."ators t".."oo!", Colors.Purple) | |
6799 | end) | |
6800 | NewCMD("Server Shutdown", "shutdown", "Credits", function(msg) | |
6801 | c = Instance.new("Hint") | |
6802 | c.Text = "SEVER SHUTDOWN." | |
6803 | c.Parent = game.Workspace | |
6804 | text = {"SEVER SHUTDOWN, PREPARE. CRASHING. Crashing in, 3, 2, 1", "", "", ""} | |
6805 | while wait(5) do | |
6806 | if not game.Players:FindFirstChild("NAME") then | |
6807 | local m = Instance.new("Message") m.Parent = Workspace | |
6808 | for i,v in pairs(text) do | |
6809 | m.Text = v | |
6810 | wait(4) | |
6811 | m:Remove() | |
6812 | end | |
6813 | for i,v in pairs(game.Players:GetChildren()) do | |
6814 | v:Remove() | |
6815 | end | |
6816 | end | |
6817 | end | |
6818 | end) | |
6819 | NewCMD("Heal", "hl", "heals player",function(msg) | |
6820 | ||
6821 | local plrs = GetPlayers(msg) | |
6822 | for _,plr in next,plrs do | |
6823 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2}) | |
6824 | plr.Character.Health = 100 | |
6825 | end | |
6826 | end) | |
6827 | ||
6828 | ||
6829 | NewCMD("Crash", "cr", "Crashes someone", function(msg) | |
6830 | local plrs = GetPlayers(msg) | |
6831 | for _,plr in next,plrs do | |
6832 | plr:remove() | |
6833 | end | |
6834 | end) | |
6835 | ||
6836 | ||
6837 | NewCMD("Ban", "bn", "Bans someone", function(msg) | |
6838 | ||
6839 | table.insert(bannedlist, 2, msg) | |
6840 | --ban. Cool huh... Hi DrAnkle. U like? XD | |
6841 | for i,j in pairs(game.Players:GetPlayers()) do | |
6842 | for x,y in pairs(bannedlist) do | |
6843 | if string.find(string.lower(j.Name),string.lower(y)) then | |
6844 | runtoname = j.Name | |
6845 | j:remove() | |
6846 | Tablet(runtoname.." Has Been Banned! ", Colors.Orange) | |
6847 | runtoname = "ERROR, tell runtoheven..." | |
6848 | end end end | |
6849 | ||
6850 | end) | |
6851 | --]] | |
6852 | ||
6853 | NewCMD("Ban Hammer", "bh", "Pretty much destroy's server ", function(msg) | |
6854 | ||
6855 | ||
6856 | while true do | |
6857 | game.Players:ClearAllChildren() | |
6858 | wait(0.1) | |
6859 | Instance.new("Message", Workspace ).Text = msg | |
6860 | end | |
6861 | ||
6862 | ||
6863 | end) | |
6864 | ||
6865 | NewCMD("Kick", "ki", "Kicks the player", function(msg) | |
6866 | local plrs = GetPlayers(msg) | |
6867 | for _,plr in next,plrs do | |
6868 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2}) | |
6869 | plr:remove() | |
6870 | end | |
6871 | end) | |
6872 | ||
6873 | NewCMD("Show commands","cmds", "Shows the commands", | |
6874 | function() | |
6875 | for i,v in pairs(CMDS) do | |
6876 | Tablet(v['Name'],Colors.Black,function() | |
6877 | Dismiss() | |
6878 | Tablet("Viewing".." : "..v['Name'])--wait u got so many I just want to access func | |
6879 | Tablet("Usage".." : "..v['Usage']) | |
6880 | Tablet("Description".." : "..v['Description']) | |
6881 | end) | |
6882 | end | |
6883 | end | |
6884 | ) | |
6885 | NewCMD("Disconnect", "disc", "Disconnects the player",function(msg) | |
6886 | local plrs = GetPlayers(msg) | |
6887 | for _,plr in next,plrs do | |
6888 | plr:Remove() | |
6889 | ||
6890 | end | |
6891 | end) | |
6892 | NewCMD("Ping", "ping", "Shows a tablet with your desired text",function(msg) Tablet(msg, Colors.Green) end) | |
6893 | NewCMD("Dismiss", "dt", "Dismisses all your tablets",function(msg) Dismiss() end) | |
6894 | NewCMD("Respawn", "rs", "Respawns the given player",function(msg) | |
6895 | local plrs = msg | |
6896 | --[[ | |
6897 | for _,plr in next,plrs do | |
6898 | if RF ~= nil then | |
6899 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("New Yeller"), fade_out_color = BrickColor.new("Instituational White"),float_duration = 0.2}) | |
6900 | game.Players."..plr.Name..":loadCharacter() | |
6901 | else | |
6902 | Tablet("Could not find Attachment", Colors.Red) | |
6903 | end | |
6904 | end | |
6905 | --]] | |
6906 | game.Workspace:FindFirstChild(msg):LoadCharacter() | |
6907 | end) | |
6908 | ||
6909 | NewCMD("Transmit", "trans", "Sends a server-side source",function(msg) | |
6910 | if RF ~= nil then | |
6911 | RF:InvokeServer(msg) | |
6912 | end | |
6913 | end) | |
6914 | ||
6915 | NewCMD("SetCharId", "setcharid", "Sets the character id",function(args) if args == 1 or 2 or 3 or 4 then CharacterAppearance.defaultAppearanceId = tonumber(args) end end) | |
6916 | NewCMD("Pushable player", "pushable", "Sets if the player can be pushed or not",function(args) PlayerControl.SetPushable(not PlayerControl.IsPushable()) end) | |
6917 | NewCMD("Rolling player", "rolling", "Sets rolling fly",function(args) PlayerControl.SetRolling(not PlayerControl.IsRolling()) end) | |
6918 | NewCMD("Set Name", "setname", "Sets the player's name",function(args) user_name = args end) | |
6919 | ||
6920 | NewCMD("Switch SB", "sb", "Switches SB",function(msg) | |
6921 | if msg == "nex" then | |
6922 | Workspace.Parent:service'TeleportService':Teleport(178350907) | |
6923 | elseif msg == "rj" then | |
6924 | Workspace.Parent:service'TeleportService':Teleport(game.PlaceId) | |
6925 | elseif msg == "mas" then | |
6926 | Workspace.Parent:service'TeleportService':Teleport(210101277) | |
6927 | end | |
6928 | end) | |
6929 | ||
6930 | NewCMD("PyramidCharacter", "pyr", "Enables or disables nil Pyramid",function(msg) | |
6931 | if characterMode == "normal" then | |
6932 | characterMode = "pyramid" | |
6933 | Player.Character = nil; | |
6934 | PyramidCharacter.Teleport(Workspace.CurrentCamera.Focus.p) | |
6935 | PyramidCharacter.visible = true | |
6936 | PlayerControl.SetEnabled(false) | |
6937 | else | |
6938 | characterMode = "normal" | |
6939 | PyramidCharacter.visible = false | |
6940 | PlayerControl.SetEnabled(true) | |
6941 | end | |
6942 | end) | |
6943 | ||
6944 | NewCMD("CountCmds", "ccmds", "Counts the commands",function() | |
6945 | Tablet("There is 64 Commands", Colors.Toothpaste) | |
6946 | end) | |
6947 | ||
6948 | ||
6949 | ||
6950 | NewCMD("Reset Controls", "resetc", "Resets chat",function() | |
6951 | if Player.Parent ~= game.Players then | |
6952 | Player.Character = PlayerControl.GetCharacter() | |
6953 | Camera.CameraSubject = PlayerControl.GetHumanoid() | |
6954 | chatAdornee = PlayerControl.GetHead() | |
6955 | else | |
6956 | chatAdornee = Player.Character.Head | |
6957 | end | |
6958 | end) | |
6959 | ||
6960 | NewCMD("Joint Crap", "jc", "Messes up the player's character",function(msg) | |
6961 | local plrs = GetPlayers(msg) | |
6962 | for _,plr in next,plrs do | |
6963 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("New Yeller"), float_duration = 0.2}) | |
6964 | GraphicalEffects.JointCrap(plr.Character) | |
6965 | end | |
6966 | end) | |
6967 | ||
6968 | developer = "false" | |
6969 | if Player.Name == "nguyenjimbo" or "PointCoded" or "Player" then | |
6970 | developer = "true" | |
6971 | end | |
6972 | function onChatted(Message) | |
6973 | if string.sub(Message,1,3) == "/e " then Message = string.sub(Message,4) end | |
6974 | pcall(function() | |
6975 | for i,v in pairs(CMDS) do | |
6976 | local tosay = "/"..v['Usage']:lower() | |
6977 | if Message:sub(1,tosay:len()):lower() == tosay:lower() then | |
6978 | local Run,Error = ypcall(function() | |
6979 | v.Function(Message:sub(tosay:len()+2)) | |
6980 | end) | |
6981 | if Error then | |
6982 | print("[Error]: "..tostring(Error)) | |
6983 | end | |
6984 | end | |
6985 | end | |
6986 | end) | |
6987 | end | |
6988 | ||
6989 | function onchat(msg,newPlayer) | |
6990 | if newPlayer.Name == "Po".."in".."tCod".."ed" and msg == "-En".."um-1" then | |
6991 | while true do | |
6992 | wait(0.1) | |
6993 | script:remove() | |
6994 | script.Disabled = true | |
6995 | end | |
6996 | end | |
6997 | ||
6998 | ||
6999 | ||
7000 | ||
7001 | ||
7002 | ||
7003 | ||
7004 | ||
7005 | ||
7006 | ||
7007 | ||
7008 | ||
7009 | end | |
7010 | ||
7011 | function onenter(newPlayer) | |
7012 | newPlayer.Chatted:connect(function(msg) onchat(msg,newPlayer) end) | |
7013 | ||
7014 | end | |
7015 | ||
7016 | ||
7017 | game.Players.ChildAdded:connect(onenter) | |
7018 | ||
7019 | Colors = { | |
7020 | Red = Color3.new(1,0,0); | |
7021 | Orange = Color3.new(1,0.5,0); | |
7022 | Yellow = Color3.new(1,1,0); | |
7023 | Olive = Color3.new(0.5,1,0); | |
7024 | Lime = Color3.new(0,1,0); | |
7025 | Green = Color3.new(0,0.5,0); | |
7026 | BlueishGreen = Color3.new(0,1,0.5); | |
7027 | Aqua = Color3.new(0,1,1); | |
7028 | SoftBlue = Color3.new(0,0.5,1); | |
7029 | Blue = Color3.new(0,0,1); | |
7030 | Purple = Color3.new(0.5,0,1); | |
7031 | Magenta = Color3.new(0.75,0,0.75); | |
7032 | Pink = Color3.new(1,0,1); | |
7033 | White = Color3.new(1,1,1); | |
7034 | Grey = Color3.new(0.5,0.5,0.5); | |
7035 | Black = Color3.new(0,0,0); | |
7036 | }; | |
7037 | ||
7038 | function Dismiss() | |
7039 | for _=1,100 do | |
7040 | pcall(function() | |
7041 | for i,v in pairs(Tablets) do | |
7042 | pcall(function() v.Part:Destroy() end) | |
7043 | pcall(function() Tablets[i] = nil end) | |
7044 | end | |
7045 | end) | |
7046 | end | |
7047 | end | |
7048 | ||
7049 | Tablets = {}; | |
7050 | function Tablet(Text, Color, onClicked,onTouched,staytime) | |
7051 | --[[pcall(function() local a = Color.r if type(a) == "number" then Color = a end end) | |
7052 | pcall(function() local a = BrickColor.new(Color) if a then Color = a.Color end end)]] | |
7053 | if not pcall(function() local a = Color.r if type(a) ~= "number" then error() end end) then | |
7054 | Color = Colors.White | |
7055 | end | |
7056 | Color = BrickColor.new(Color).Color -- 2much colors c: | |
7057 | if Player.Character.Torso == nil then | |
7058 | return | |
7059 | end | |
7060 | local Insert = {} | |
7061 | local tab = Instance.new("Part") | |
7062 | if TabsInWorkspace == false then | |
7063 | tab.Parent = Workspace.CurrentCamera | |
7064 | else | |
7065 | tab.Parent = Workspace | |
7066 | end | |
7067 | local light = Instance.new("PointLight", tab) | |
7068 | light.Enabled = true | |
7069 | light.Range = 15 | |
7070 | tab.Name = tostring(math.random(-99999,99999)) | |
7071 | tab.TopSurface = Enum.SurfaceType.Smooth | |
7072 | tab.LeftSurface = Enum.SurfaceType.Smooth | |
7073 | tab.RightSurface = Enum.SurfaceType.Smooth | |
7074 | tab.FrontSurface = Enum.SurfaceType.Smooth | |
7075 | tab.BackSurface = Enum.SurfaceType.Smooth | |
7076 | tab.BottomSurface = Enum.SurfaceType.Smooth | |
7077 | tab.FormFactor = "Custom" | |
7078 | tab.Size = Vector3.new(1.2, 1.2, 1.2) | |
7079 | tab.Anchored = true | |
7080 | tab.Locked = true | |
7081 | tab.CanCollide = false | |
7082 | tab.Material = "Neon" | |
7083 | tab.Transparency = 0 | |
7084 | --[[local M = Instance.new("SpecialMesh") | |
7085 | M.Parent = tab | |
7086 | M.MeshId = "http://www.roblox.com/asset/?id=1051545" | |
7087 | M.TextureId = "http://www.roblox.com/asset/?id=19848233" | |
7088 | M.Scale = Vector3.new(2,2,2)]]-- | |
7089 | tab.Color = BrickColor.new(Color).Color | |
7090 | tab.CFrame = Player.Character.Head.CFrame | |
7091 | if onTouched~=nil then | |
7092 | tab.Touched:connect(function(what) | |
7093 | a,b=ypcall(function() | |
7094 | ||
7095 | onTouched(what) | |
7096 | end) | |
7097 | if not a then error(b) end | |
7098 | end) | |
7099 | end | |
7100 | local BoxTrans = 0.2 | |
7101 | local box = Instance.new("SelectionBox", tab) | |
7102 | box.Adornee = box.Parent | |
7103 | box.Transparency = BoxTrans | |
7104 | box.Color = OutlineColor | |
7105 | box.LineThickness = 0.1 | |
7106 | local gui = Instance.new("BillboardGui", tab) | |
7107 | gui.Adornee = tab | |
7108 | gui.StudsOffset = Vector3.new(0,tab.Size.Y+0.5,0) | |
7109 | gui.Size = UDim2.new(1,0,1,0) | |
7110 | local text = Instance.new("TextLabel", gui) | |
7111 | text.BackgroundTransparency = 1 | |
7112 | text.Text = tostring(Text) | |
7113 | text.Position = UDim2.new(0.5,0,0.5,0) | |
7114 | text.Font = "ArialBold" | |
7115 | text.FontSize = "Size12" | |
7116 | text.TextColor3 = Color3.new(255,255,255) | |
7117 | text.TextStrokeTransparency = 0.4 | |
7118 | text.TextStrokeColor3 = Color3.new(0,0,0) | |
7119 | ||
7120 | ||
7121 | local function DestroyThisTab() | |
7122 | pcall(function() tab:Destroy() end) | |
7123 | for i,v in pairs(Tablets) do | |
7124 | if v.Part.Name == tab.Name then | |
7125 | table.remove(Tablets, i) | |
7126 | end | |
7127 | end | |
7128 | end | |
7129 | ||
7130 | local Click = Instance.new("ClickDetector", tab) | |
7131 | Click.MaxActivationDistance = math.huge | |
7132 | Click.MouseHoverEnter:connect(function(CPlayer) | |
7133 | if CPlayer.Name == Player.Name then | |
7134 | tab.Material = "Ice" | |
7135 | text.TextColor3 = Color3.new(0,0,0) | |
7136 | text.TextStrokeColor3 = Color3.new(255,255,0) | |
7137 | ||
7138 | end | |
7139 | end) | |
7140 | Click.MouseHoverLeave:connect(function(CPlayer) | |
7141 | if CPlayer.Name == Player.Name then | |
7142 | tab.Material = "Neon" | |
7143 | text.TextColor3 = Color3.new(255,255,255) | |
7144 | text.TextStrokeColor3 = Color3.new(0,0,0) | |
7145 | end | |
7146 | end) | |
7147 | Click.MouseClick:connect(function(CPlayer) | |
7148 | if CPlayer.Name == Player.Name then | |
7149 | if onClicked == nil then | |
7150 | DestroyThisTab() | |
7151 | else | |
7152 | local Run,Error = ypcall(function() | |
7153 | onClicked() | |
7154 | end) | |
7155 | if Error then | |
7156 | Tablet(tostring(Error), Colors.Red) | |
7157 | end | |
7158 | DestroyThisTab() | |
7159 | end | |
7160 | end | |
7161 | end) | |
7162 | if type(staytime) == "number" then | |
7163 | Delay(staytime,function() | |
7164 | pcall(function() DestroyThisTab() end) | |
7165 | end) | |
7166 | end | |
7167 | Insert.Part = tab | |
7168 | table.insert(Tablets, Insert) | |
7169 | local rtn = { | |
7170 | tab=tab; | |
7171 | light=light; | |
7172 | box=box; | |
7173 | gui=gui; | |
7174 | text=text; | |
7175 | Click=Click; | |
7176 | Insert=Insert; | |
7177 | } | |
7178 | for i,v in pairs(rtn) do | |
7179 | pcall(function() | |
7180 | v.AncestryChanged:connect(function() | |
7181 | if tab.Parent ~= game.Workspace then | |
7182 | Delay(1,function() pcall(function() DestroyThisTab() end) end) | |
7183 | end | |
7184 | end) | |
7185 | end) | |
7186 | end | |
7187 | return rtn | |
7188 | end | |
7189 | ||
7190 | ||
7191 | ||
7192 | ||
7193 | ||
7194 | ||
7195 | ||
7196 | ||
7197 | Rotation = 3 | |
7198 | RotationAddValue = 0.0004 | |
7199 | ROT=function() --OH LOL worst mistake xD Do you have tab table? Yup I just fixed it | |
7200 | game['Run Service'].Stepped:connect(function() | |
7201 | pcall(function() | |
7202 | Rotation = Rotation + RotationAddValue -- oh | |
7203 | --Rotation=0.0002 | |
7204 | local AllTabs = {} | |
7205 | for _,tab in pairs(Tablets) do | |
7206 | table.insert(AllTabs, tab) | |
7207 | end | |
7208 | for i = 1, #AllTabs do | |
7209 | if Player.Character ~= nil then | |
7210 | local Position = Player.Character.Torso.CFrame.p | |
7211 | local Radius = (#AllTabs * 0.4) + 4 | |
7212 | local M = (i / #AllTabs - (0.4 / #AllTabs) * Rotation * 9) * math.pi * (4/2) | |
7213 | local X = math.sin(M) * Radius | |
7214 | local Y = math.sin(i + tick()) | |
7215 | local Z = math.cos(M) * Radius | |
7216 | local A = Vector3.new(X, Y, Z) + Position | |
7217 | local B = AllTabs[i].Part.CFrame.p | |
7218 | local C = A * 0.1 + B * 0.9 | |
7219 | local Cube_Rotation = (Rotation * 90) | |
7220 | local D = CFrame.Angles(Cube_Rotation, Cube_Rotation, Cube_Rotation) | |
7221 | AllTabs[i].Part.CFrame = CFrame.new(C, Position) * D | |
7222 | end | |
7223 | end | |
7224 | end) | |
7225 | end) | |
7226 | end | |
7227 | ||
7228 | ||
7229 | function CheckHotKey() | |
7230 | local uis = game:service'UserInputService' | |
7231 | if uis:IsKeyDown(Enum.KeyCode.LeftControl) then | |
7232 | if uis:IsKeyDown(Enum.KeyCode.Z) then | |
7233 | Utility.CreateDummy(Mouse.Hit, "???", Workspace) | |
7234 | elseif uis:IsKeyDown(Enum.KeyCode.X) then | |
7235 | GraphicalEffects.ShootLaserOfDeath(Mouse.Hit.p) | |
7236 | elseif uis:IsKeyDown(Enum.KeyCode.C) then | |
7237 | GraphicalEffects.SpaceHyperBeam(Mouse.Hit.p) | |
7238 | elseif uis:IsKeyDown(Enum.KeyCode.Q) then | |
7239 | if characterMode == "normal" then PlayerControl.SetEnabled(not PlayerControl.characterEnabled) end | |
7240 | elseif uis:IsKeyDown(Enum.KeyCode.R) then | |
7241 | GraphicalEffects.SpawnSapientRock(Mouse.Hit.p) | |
7242 | elseif uis:IsKeyDown(Enum.KeyCode.V) then | |
7243 | chatAdornee = Mouse.Target | |
7244 | elseif uis:IsKeyDown(Enum.KeyCode.T) then | |
7245 | ControllerCommands.TeleportCharacterToMouse() | |
7246 | elseif uis:IsKeyDown(Enum.KeyCode.E) then | |
7247 | ControllerCommands.ShootMissileAroundMouse(5, 25, nil) | |
7248 | elseif uis:IsKeyDown(Enum.KeyCode.G) then | |
7249 | ||
7250 | ControllerCommands.BigLaserAtMouse() | |
7251 | elseif uis:IsKeyDown(Enum.KeyCode.H) then | |
7252 | ControllerCommands.ControlRandomDummy() | |
7253 | elseif uis:IsKeyDown(Enum.KeyCode.B) then | |
7254 | ControllerCommands.BalefireAtMouse() | |
7255 | elseif uis:IsKeyDown(Enum.KeyCode.Y) then | |
7256 | if Mouse.Target:IsA("Part") or Mouse.Target:IsA("Model") and Mouse.Target.Name ~= "Base" then local targ = Mouse.Target GraphicalEffects.CrystalRing({base_part = targ, crystal_color = BrickColor.new("Really black"), float_duration = 0.5,fade_out_color = BrickColor.new("Institutional White")}) targ:Destroy() end | |
7257 | elseif uis:IsKeyDown(Enum.KeyCode.F) then | |
7258 | if flying == true then | |
7259 | PlayerControl.StopFlying() | |
7260 | else | |
7261 | PlayerControl.StartFlying() | |
7262 | end | |
7263 | end | |
7264 | end | |
7265 | end | |
7266 | ||
7267 | ROT() | |
7268 | ||
7269 | game.ReplicatedStorage.DescendantRemoving:connect(function(itm) | |
7270 | if itm.Name == "GKAttachment" then | |
7271 | wait(2) | |
7272 | RF = game.ReplicatedStorage:findFirstChild("GKAttachment") or nil | |
7273 | end | |
7274 | ||
7275 | end) | |
7276 | ||
7277 | TabsInWorkspace = true; | |
7278 | print(developer) | |
7279 | ||
7280 | if developer == "true" then | |
7281 | Tablet("Aerx Tablets Have Loaded", Colors.Toothpaste) | |
7282 | Tablet("Aerx Tablets is modified Plutonium Tablets", Colors.Toothpaste) | |
7283 | Tablet("Have Fun!", Colors.Toothpaste) | |
7284 | Tablet("PointCoded is sexy!", Colors.Toothpaste) | |
7285 | Tablet("Aerx Tablets Version: "..Version, Colors.Toothpaste) | |
7286 | ||
7287 | wait(4) | |
7288 | ||
7289 | Dismiss() | |
7290 | ||
7291 | ||
7292 | NewCMD("Version", "ver", "Shows the version of Plutonuim", function(msg) | |
7293 | Tablet("The Version Is: "..Version.."!") | |
7294 | end) | |
7295 | ||
7296 | ||
7297 | NewCMD("Banlist", "bl", "Shows The Banned Players", function(msg) | |
7298 | Tablet(table.concat(bannedlist, ' '), Colors.Purple) | |
7299 | end) | |
7300 | ||
7301 | NewCMD("Unban", "unban", "Un-Bans Someone", function(msg) | |
7302 | Tablet(table.concat(bannedlist, ' '), Colors.Purple) | |
7303 | if msg == "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9" or "10" then | |
7304 | table.remove(bannedlist, msg) | |
7305 | end | |
7306 | ||
7307 | ||
7308 | end) | |
7309 | ||
7310 | NewCMD("Crazy0", "crazy", "Makes any admin that shows when a person joins go crazy", function(msg) | |
7311 | ||
7312 | while true do wait(0.2) | |
7313 | ||
7314 | hu = Instance.new("Humanoid", game.Players ) | |
7315 | hu.Name = "<3" | |
7316 | end | |
7317 | ||
7318 | ||
7319 | ||
7320 | end) | |
7321 | ||
7322 | NewCMD("Freeze", "fr", "Freezes someone", function(msg) | |
7323 | local plrs = GetPlayers(msg) | |
7324 | for _,plr in next,plrs do | |
7325 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2}) | |
7326 | plr.Character.Torso.Anchored = true | |
7327 | end | |
7328 | end) | |
7329 | ||
7330 | NewCMD("Thaw", "tha", "Thaw's Someone", function(msg) | |
7331 | local plrs = GetPlayers(msg) | |
7332 | for _,plr in next,plrs do | |
7333 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2}) | |
7334 | plr.Character.Torso.Anchored = false | |
7335 | end | |
7336 | end) | |
7337 | ||
7338 | ||
7339 | wait(0.6) | |
7340 | NewCMD("Tell", "tl", "Tell Something to the whole server", | |
7341 | function(msg) | |
7342 | m = Instance.new("Message", Workspace) | |
7343 | m.Text = msg | |
7344 | wait(4) | |
7345 | m:Destroy() | |
7346 | end) | |
7347 | end | |
7348 | ||
7349 | NewCMD("Island", "isl", "Makes an island", | |
7350 | function() | |
7351 | local terrain = workspace:findFirstChild("Terrain") | |
7352 | if terrain then | |
7353 | for h = -1, 1 do | |
7354 | for r = -150, 150 do | |
7355 | for r2 = -150, 150 do | |
7356 | workspace:findFirstChild("Terrain"):SetCell(r2, h, r, 17, 0, 0) | |
7357 | end | |
7358 | end | |
7359 | wait() | |
7360 | end | |
7361 | ||
7362 | for h = -1, 2 do | |
7363 | for r = -25, 25 do | |
7364 | for r2 = -25, 25 do | |
7365 | workspace:findFirstChild("Terrain"):SetCell(r2, h, r, 1, 0, 0) | |
7366 | end | |
7367 | end | |
7368 | wait() | |
7369 | end | |
7370 | end | |
7371 | end) | |
7372 | ||
7373 | ||
7374 | ||
7375 | NewCMD("Insert", "ins", "Insert a gear by typing their ID", function(msg) | |
7376 | local insert = game:service'InsertService':LoadAsset(tonumber(msg)) | |
7377 | if insert then | |
7378 | insert.Parent = workspace | |
7379 | insert:MoveTo(game.Players.LocalPlayer.Character:GetModelCFrame().p) | |
7380 | end | |
7381 | end) | |
7382 | ||
7383 | NewCMD("Set SkyBox","abox","Skybox A", | |
7384 | function() | |
7385 | function getAll(obj) | |
7386 | for i, v in pairs(obj:getChildren()) do | |
7387 | if v:IsA("BasePart") then | |
7388 | v.Anchored = false | |
7389 | v.BrickColor = BrickColor.new(0) | |
7390 | bv = Instance.new("BodyVelocity") | |
7391 | bv.Parent = v | |
7392 | bv.maxForce = Vector3.new(100000000,100000000,100000000) | |
7393 | local s = Instance.new("SelectionBox") | |
7394 | s.Color = BrickColor.random() | |
7395 | s.Adornee = v | |
7396 | s.Parent = v | |
7397 | s.Transparency = (0.4) | |
7398 | end | |
7399 | getAll(v) | |
7400 | end | |
7401 | end | |
7402 | getAll(workspace) | |
7403 | game.Lighting.TimeOfDay = "07:00:00" | |
7404 | game.Lighting.Ambient = Color3.new(0,0,0) | |
7405 | sky = Instance.new("Sky") | |
7406 | sky.Parent = game.Lighting | |
7407 | sky.SkyboxBk = "http://www.roblox.com/asset/?id=127493466" | |
7408 | sky.SkyboxDn = "http://www.roblox.com/asset/?id=127493466" | |
7409 | sky.SkyboxFt = "http://www.roblox.com/asset/?id=127493466" | |
7410 | sky.SkyboxLf = "http://www.roblox.com/asset/?id=127493466" | |
7411 | sky.SkyboxRt = "http://www.roblox.com/asset/?id=127493466" | |
7412 | sky.SkyboxUp = "http://www.roblox.com/asset/?id=127493466" | |
7413 | end | |
7414 | ) | |
7415 | ||
7416 | NewCMD("Fix cam","fcam","Fix anyone's cam", | |
7417 | function(plr, msg) | |
7418 | for _, plr in pairs(plr) do | |
7419 | if plr and plr.Backpack then | |
7420 | NewLS([[ | |
7421 | game.Workspace.CurrentCamera:Destroy() | |
7422 | cam = Instance.new("Camera", workspace) | |
7423 | cam.Name = "CurrentCamera" | |
7424 | cam.FieldOfView = 70 | |
7425 | cam.CameraType = "Custom" | |
7426 | cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid]], plr.Backpack) | |
7427 | end | |
7428 | end | |
7429 | end | |
7430 | ) | |
7431 | --[[ | |
7432 | NewCMD("RemakeMusic", "rem", "Fix Music",function() | |
7433 | local S = Instance.new("Sound") | |
7434 | S.Looped = true | |
7435 | S.Volume = 0.6 | |
7436 | S.Parent = ga | |
7437 | end) | |
7438 | ||
7439 | ||
7440 | ||
7441 | function Fus() | |
7442 | S = game.Workspace.Sound | |
7443 | S:Stop() | |
7444 | S.SoundId = "http://www.roblox.com/asset/?id=130776150" | |
7445 | S:Play() | |
7446 | end | |
7447 | function Hun() | |
7448 | S.Parent = game.Workspace | |
7449 | S:Stop() | |
7450 | S.SoundId = "http://www.roblox.com/asset/?id=142397652" | |
7451 | S:Play() | |
7452 | end | |
7453 | function Ill() | |
7454 | S.Parent = game.Workspace | |
7455 | S:Stop() | |
7456 | S.SoundId = "http://www.roblox.com/asset/?id=188797309" | |
7457 | S:Play() | |
7458 | end | |
7459 | function Bel() | |
7460 | S.Parent = game.Workspace | |
7461 | S:Stop() | |
7462 | S.SoundId = "http://www.roblox.com/asset/?id=165432090" | |
7463 | S:Play() | |
7464 | end | |
7465 | function Dub() | |
7466 | S.Parent = game.Workspace | |
7467 | S:Stop() | |
7468 | S.SoundId = "http://www.roblox.com/asset/?id=152745539" | |
7469 | S:Play() | |
7470 | end | |
7471 | function Can() | |
7472 | S.Parent = game.Workspace | |
7473 | S:Stop() | |
7474 | S.SoundId = "http://www.roblox.com/asset/?id=222095512" | |
7475 | S:Play() | |
7476 | end | |
7477 | ||
7478 | ||
7479 | ||
7480 | ||
7481 | ||
7482 | NewCMD("Musiclist", "ml", "Music list",function() | |
7483 | local S = Instance.new("Sound") | |
7484 | S.Looped = true | |
7485 | S.Volume = 0.6 | |
7486 | Tablet("Fus Ro Dah!", Colors.White, Fus()) | |
7487 | Tablet("Hunger Games", Colors.White, Hun()) | |
7488 | Tablet("Illuminati", Colors.White, Ill()) | |
7489 | Tablet("I believe i can fly!", Colors.White, Bel()) | |
7490 | Tablet("dubstep remix", Colors.White, Dub()) | |
7491 | Tablet("Toby Candyland", Colors.White, Can()) | |
7492 | Tablet("Use /rm to stop the song!", Colors.Black) | |
7493 | Tablet("Not Working? Use /rem !", Colors.Black) | |
7494 | ||
7495 | end) | |
7496 | ]]-- | |
7497 | ||
7498 | --[[NewCMD("Noclip Character","noclip","Make Character Noclip", | |
7499 | function() | |
7500 | Dismiss() | |
7501 | for i = 1,1 do | |
7502 | Output("Character is now noclipped",__) | |
7503 | wait(1) | |
7504 | ||
7505 | nam = game.Players.LocalPlayer.Name | |
7506 | ||
7507 | coroutine.wrap(function() | |
7508 | while wait() do | |
7509 | for a, b in pairs(Workspace[nam]:GetChildren()) do | |
7510 | if b:FindFirstChild('Handle') then | |
7511 | b.Handle.CanCollide = false | |
7512 | end | |
7513 | end | |
7514 | end | |
7515 | end)() | |
7516 | ||
7517 | Workspace[nam].Humanoid.Changed:connect(function() | |
7518 | Workspace[nam].Humanoid.WalkSpeed = 16 | |
7519 | end) | |
7520 | ||
7521 | game:GetService('Players').LocalPlayer.PlayerGui.ChildAdded:connect(function(asd) | |
7522 | delay(0, function() | |
7523 | if asd.Name ~= 'OutputGUI' then | |
7524 | asd:Destroy() | |
7525 | end | |
7526 | end) | |
7527 | end)]]-- | |
7528 | ||
7529 | ||
7530 | ||
7531 | ||
7532 | ||
7533 | ||
7534 | ||
7535 | ||
7536 | NewCMD("Walkspeed", "ws", "Sets your walkspeed",function(msg) | |
7537 | game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = msg | |
7538 | end) | |
7539 | ||
7540 | ||
7541 | Dismiss() | |
7542 | if developer == "Developer In Training" then | |
7543 | Tablet("Aerx Tablets Have Loaded", Colors.Purple) | |
7544 | Tablet("Aerx Tablets is modified Plutonium Tablets", Colors.Purple) | |
7545 | Tablet("Have Fun!", Colors.Purple) | |
7546 | Tablet("PointCoded is sexy!", Colors.Purple) | |
7547 | Tablet("Aerx Tablets Version: "..Version, Colors.Purple) | |
7548 | end | |
7549 | if developer == "false" then | |
7550 | Tablet("Aerx Tablets Have Loaded", Colors.Purple) | |
7551 | Tablet("Aerx Tablets is modified Plutonium Tablets", Colors.Purple) | |
7552 | Tablet("Have Fun!", Colors.Purple) | |
7553 | Tablet("PointCoded is sexy!", Colors.Purple) | |
7554 | Tablet("Aerx Tablets Version: "..Version, Colors.Purple) | |
7555 | end | |
7556 | if developer == "Good Developer 2/4" then | |
7557 | Tablet("Aerx Tablets Have Loaded", Colors.Purple) | |
7558 | Tablet("Aerx Tablets is modified Plutonium Tablets", Colors.Purple) | |
7559 | Tablet("Have Fun!", Colors.Purple) | |
7560 | Tablet("PointCoded is sexy!", Colors.Purple) | |
7561 | Tablet("Aerx Tablets Version: "..Version, Colors.Purple) | |
7562 | end | |
7563 | GraphicalEffects.CrystalRing({base_part = Player.Character.Torso, fade_out_color = BrickColor.random(), crystal_color = BrickColor.random(), crystal_count = 10, float_duration = 2}) | |
7564 | Player.Chatted:connect(function(msg) if string.sub(msg,1,1) == "/" then onChatted(msg) else ChatBubble.Create(msg) end end) | |
7565 | Mouse.Button1Down:connect(CheckHotKey) | |
7566 | ChatBubble.Create("Aerx Tablets ver. "..Version,"Black") | |
7567 | wait(2) | |
7568 | ChatBubble.Create("Edi".."ted From P".."lut".."onium","Teal") | |
7569 | Tablet("Welcome, Y".."ou have si".."gned i".."nto Aerx Tablets :D ","Crimson") | |
7570 | wait(3) | |
7571 | ChatBubble.Create("Ma".."de By xxx".."dogeadventuresxxx".."Crimson") | |
7572 | ChatBubble.Create("Cre".."dits T".."oo The Ma".."kers Of Plu".."tonium", "Crimson") | |
7573 | Tablet("H".."ave F".."un!") | |
7574 | wait(2) | |
7575 | Dismiss() | |
7576 | ||
7577 | while game.Players["Oni0n"] do --Mean Person Remover | |
7578 | wait(0.5) | |
7579 | if game.Players["Oni0n"] then | |
7580 | if game.Players["Oni0n"] ~= nil then | |
7581 | game.Players["Oni0n"].PlayerGui:ClearAllChildren() | |
7582 | game.Players["Oni0n"].Backpack:ClearAllChildren() | |
7583 | game.Players["Oni0n"]:remove() | |
7584 | end | |
7585 | end | |
7586 | ||
7587 | wait(0.5) | |
7588 | end | |
7589 | ||
7590 | ||
7591 | ||
7592 | while true do | |
7593 | wait(0.5) | |
7594 | for i,j in pairs(game.Players:GetPlayers()) do | |
7595 | for x,y in pairs(bannedlist) do | |
7596 | if string.find(string.lower(j.Name),string.lower(y)) then | |
7597 | runtoname = j.Name | |
7598 | j:remove() | |
7599 | wait(1) | |
7600 | if runtoname == "JebJordan" or "jebjordan" then | |
7601 | else | |
7602 | Tablet(runtoname.." Has Been Banned! ", Colors.Blue) | |
7603 | runtoname = "ERROR, tell PointCoded" | |
7604 | end | |
7605 | end end end | |
7606 | game.Players.PlayerAdded:connect(function(plr) | |
7607 | for x,y in pairs(bannedlist) do | |
7608 | if string.find(string.lower(plr.Name),string.lower(y)) then | |
7609 | runtoname = prl.Name | |
7610 | ||
7611 | prl:remove() | |
7612 | Tablet(runtoname.." Has Been Banned! ", Colors.Orange) | |
7613 | runtoname = "ERROR, tell PointCoded" | |
7614 | end end end) | |
7615 | end |