Advertisement
memberhero

Custom Admin Script

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