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