Advertisement
memesbruh03

Model A.E.R.C v0.1.0

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