Advertisement
deezfai

Untitled

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