Advertisement
CLarramore

gk #15

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