Advertisement
iiHackerii

Untitled

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