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