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