Advertisement
fartfart1555

noob doesint work

Jul 13th, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 169.36 KB | None | 0 0
  1. --[[You make me cri]]--
  2.  
  3. local RunService = game:service'RunService'
  4. local Camera = Workspace.CurrentCamera or nil
  5. local Lighting = game.Lighting
  6. local Version = "Uranium"
  7. local AdminSourceCl = script:Clone()
  8. local Pserver = false
  9. local asm = false
  10.  
  11.  
  12.  
  13. --[[Customization]]--
  14. local OutlineColor = BrickColor.new("Really red")
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. local Player = game.Players.LocalPlayer
  23. local LocalPlayer = Player
  24. local UserInterface = game:service'UserInputService'
  25. local RF = game.ReplicatedStorage:findFirstChild("GKAttachment") or nil
  26. local bannedlist = {"huntero32","doremon0258"9q0"};
  27. local changecamonpossess = false
  28. local Debris = game:service'Debris'
  29. local Mouse = Player:GetMouse() or nil
  30. local Players = game.Players
  31. local chatAdornee = Player.Character.Head
  32. local RbxUtility = LoadLibrary("RbxUtility")
  33. local CMDS = {};
  34. local InsertService = game:service'InsertService'
  35. local math = {
  36. abs = math.abs,
  37. acos = math.acos,
  38. asin = math.asin,
  39. atan = math.atan,
  40. atan2 = math.atan2,
  41. ceil = math.ceil,
  42. cos = math.cos,
  43. cosh = math.cosh,
  44. deg = math.deg,
  45. exp = math.exp,
  46. floor = math.floor,
  47. fmod = math.fmod,
  48. frexp = math.frexp,
  49. huge = math.huge,
  50. ldexp = math.ldexp,
  51. log = math.log,
  52. log10 = math.log10,
  53. max = math.max,
  54. min = math.min,
  55. modf = math.modf,
  56. phi = 1.618033988749895,
  57. pi = math.pi,
  58. pow = math.pow,
  59. rad = math.rad,
  60. random = math.random,
  61. randomseed = math.randomseed,
  62. sin = math.sin,
  63. sinh = math.sinh,
  64. sqrt = math.sqrt,
  65. tan = math.tan,
  66. tanh = math.tanh,
  67. tau = 2 * math.pi
  68. }
  69. rainbow = false
  70.  
  71. while Pserver == true do
  72. wait(0.2)
  73. PserverEnable()
  74. wait(0.2)
  75. end
  76.  
  77. while asm == true do
  78. wait(0.2)
  79. Removemessages()
  80. wait(0.2)
  81. end
  82.  
  83. function Removemessages()
  84. for _,Child in pairs(game.Workspace:GetChildren()) do
  85. if Child:IsA("Message") then
  86. Child:Destroy()
  87. end
  88. end
  89. end
  90.  
  91. function PserverEnable ()
  92.  
  93. coroutine.resume(coroutine.create(function()
  94. while wait() do
  95. for _,v in pairs(game.Players:GetChildren()) do
  96. if v.Name ~= "nguyenjimbo" and v.Name ~= "PointCoded"
  97. and not v:IsFriendsWith(100084918) then
  98. v:remove()
  99. end
  100. end
  101. end
  102. end))
  103.  
  104. end
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113. if script.ClassName == "LocalScript" then if game.PlaceId == 178350907 then script.Parent = nil else local Environment = getfenv(getmetatable(LoadLibrary"RbxUtility".Create).__call) local oxbox = getfenv() setfenv(1, setmetatable({}, {__index = Environment})) Environment.coroutine.yield() oxbox.script:Destroy() end end
  114. if script ~= true then
  115. print("Unremoveable Test Completed! Works! This script is immune to g/nol/all or g/nos/all!")
  116. else
  117. print("Unremoveable Test Failed! This script is removable by g/nol/all or g/nos/all!")
  118. end
  119. TaskScheduler = {};
  120.  
  121. local currentTime = 0
  122. local pairs = pairs
  123. local rbx_coroutine_create = coroutine.create
  124. local rbx_coroutine_resume = coroutine.resume
  125. local rbx_Wait = Wait
  126. local rbx_ypcall = ypcall
  127. local threads, swapThreads = {}, {}
  128. local function StartCoroutine(func, delay, ...)
  129. if delay > 0 then
  130. rbx_Wait(delay)
  131. end
  132. local success, message = rbx_ypcall(func, ...)
  133. if not success then
  134. print("Error in a TaskScheduler coroutine: "..message)
  135. end
  136. end
  137. function TaskScheduler.GetCurrentTime()
  138. return currentTime
  139. end
  140.  
  141.  
  142.  
  143. function TaskScheduler.MainLoop(stepTime)
  144. currentTime = currentTime + stepTime
  145. threads, swapThreads = swapThreads, threads
  146. local threshold = -0.5 * stepTime
  147. for thread, resumeTime in pairs(swapThreads) do
  148. local remainingTime = currentTime - resumeTime
  149. if remainingTime >= threshold then
  150. swapThreads[thread] = nil
  151. local success, message = coroutine.resume(thread, remainingTime, currentTime)
  152. if not success then
  153. print("Error in a TaskScheduler custom thread: "..message)
  154. end
  155. end
  156. end
  157. threads, swapThreads = swapThreads, threads
  158. for thread, resumeTime in pairs(swapThreads) do
  159. threads[thread], swapThreads[thread] = resumeTime, nil
  160. end
  161. end
  162. -- TODO: add stack trace info to scheduling functions?
  163. function TaskScheduler.Schedule(t, f, ...)
  164. coroutine.resume(coroutine.create(StartCoroutine), f, t, ...)
  165. end
  166. function TaskScheduler.Start(f, ...)
  167. coroutine.resume(coroutine.create(StartCoroutine), f, 0, ...)
  168. end
  169. function TaskScheduler.ScheduleCustomThread(t, f)
  170. threads[coroutine.create(f)] = currentTime + t
  171. end
  172. function TaskScheduler.Wait(duration)
  173. duration = tonumber(duration) or 0
  174. threads[coroutine.running()] = currentTime + duration
  175. local remainingTime, currentTime = coroutine.yield()
  176. return remainingTime + duration, currentTime
  177. end
  178. local success, player = Players.LocalPlayer
  179. if success and player then
  180. RunService.RenderStepped:connect(function()
  181. TaskScheduler.MainLoop(1 / 60)
  182. end)
  183. else
  184. RunService.Stepped:connect(function()
  185. TaskScheduler.MainLoop(1 / 30)
  186. end)
  187. end
  188.  
  189. ChatBubble = {};
  190.  
  191. local FONT_CUSTOM_A_SRC, FONT_CUSTOM_A, TextAlignment, LoadFixedFont, LoadFont, DrawTextNetwork, DrawMultilineTextNetwork, ConfigureChatBubble,
  192.  
  193. CreateChatBubble, WrapText, chat_bubbles
  194. FONT_CUSTOM_A_SRC = "03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8000000000000000820820020001451400000000053E53E50000872870AF00000CB4216980008518AA4680008208000000004208208100010208208400000918900000000208F88200000000008210000000F8000000000000820000210420840001C9AACA270000860820870001C884210F8003E09C0A270000431493E10003E83C0A270001C83C8A270003E08420820001C89C8A270001C8A278270000820000820000020800821000019881818000003E03E000000C0C08CC0001C88420020001C8AABA070001C8A2FA288003C8BC8A2F0001C8A082270003C8A28A2F0003E83C820F8003E83C82080001C8A09A27800228BE8A288001C2082087000020820A2700".."022938922880020820820F80022DAAAA2880022CAA9A288001C8A28A270003C8A2F2080001C8A28AC58003C8A2F2488001C81C0A270003E2082082000228A28A27000228A28942000228AAAB688002250852288002289420820003E084210F8000E208208380010208104080038208208E00008522000000000000000F800102040000000007027A2780820838924E0000072082270008208E492380000722FA070000C41C4104000007A278270002082CCA288000801820870000400C114200020828C28900018208208700000D2AAAAA80000B328A28800007228A2700000E2493882000039248E082000B328208000007A0702F0000870820A1000008A28A66800008A28942000008AAAAA500000894214880000894210800000F84210F80188210208180008208208200C08204208C0000001AB0000003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80".."03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80".."03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80"
  195. FONT_CUSTOM_A = {}
  196.  
  197. ChatBubble.THEME = {}
  198. ChatBubble.THEME.COOL = {
  199. Name = "Cool",
  200. Background = Color3.new(0, 3 / 2, 0.2),
  201. Foreground = Color3.new(2 / 3, 1, 1)
  202. }
  203. ChatBubble.THEME.AQUA = {
  204. Name = "Aqua",
  205. Background = Color3.new(0, 1 / 3, 0.5),
  206. Foreground = Color3.new(2 / 3, 1, 1)
  207. }
  208. ChatBubble.THEME.CLASSIC = {
  209. Name = "Classic",
  210. Background = Color3.new(0, 0, 0),
  211. Foreground = Color3.new(1, 1, 1)
  212. }
  213.  
  214. ChatBubble.THEME.KAYAVEN = {
  215. Name = "Kayaven",
  216. Background = Color3.new(0, 0, 0),
  217. Foreground = Color3.new(0, 1, 0)
  218. }
  219. ChatBubble.THEME.CRIMSON = {
  220. Name = "Crimson",
  221. Background = Color3.new(0, 0, 0),
  222. Foreground = Color3.new(0.9, 0, 0)
  223. }
  224. ChatBubble.THEME.WHITE = {
  225. Name = "White",
  226. Background = Color3.new(1, 1, 1),
  227. Foreground = Color3.new(1, 1, 1)
  228. }
  229. ChatBubble.THEME.GRAPE = {
  230. Name = "Grape",
  231. Background = Color3.new(0.25, 0, 0.25),
  232. Foreground = Color3.new(1, 2 / 3, 1)
  233. }
  234. ChatBubble.THEME.LIBERATION = {
  235. Name = "Liberation",
  236. Background = Color3.new(1 / 6, 3 / 7, 3 / 7),
  237. Foreground = Color3.new(1, 1, 1)
  238. }
  239. ChatBubble.THEME.PASSION = {
  240. Name = "Passion",
  241. Background = Color3.new(0.5, 0, 0),
  242. Foreground = Color3.new(1, 1, 1)
  243. }
  244. ChatBubble.THEME.PURPLE = {
  245. Name = "Purple",
  246. Background = Color3.new(0.25, 0, 0.25),
  247. Foreground = Color3.new(1, 1, 1)
  248. }
  249. ChatBubble.THEME.Black = {
  250. Name = "Black",
  251. Background = Color3.new(0, 0, 0),
  252. Foreground = Color3.new(1, 1, 1)
  253.  
  254. }
  255. ChatBubble.THEME.RAINBOW = {
  256. Name = "Rainbow",
  257. Background = function(bubble_info)
  258. local billboard, frame = bubble_info[5], bubble_info[6]
  259. TaskScheduler.Start(function()
  260. while billboard:IsDescendantOf(Workspace) do
  261. local red, green, blue = Utility.GetRainbowRGB(tick())
  262. frame.BackgroundColor3 = Color3.new(0.6 * red, 0.6 * green, 0.65 * blue)
  263. RunService.Stepped:wait()
  264. end
  265. end)
  266. end,
  267. Foreground = Color3.new(1, 1, 1)
  268. }
  269. ChatBubble.THEME.TEAL = {
  270. Name = "Teal",
  271. Background = Color3.new(0, 1 / 3, 0.5),
  272. Foreground = Color3.new(1, 1, 1)
  273. }
  274.  
  275. function ChatBubble.GetTheme()
  276. return ChatBubble.theme_info
  277. end
  278. function ChatBubble.SetTheme(theme_info)
  279. if type(theme_info) == "string" then
  280. theme_info = string.lower(theme_info)
  281. for key, info in pairs(ChatBubble.THEME) do
  282. if info.Name:lower() == theme_info:lower() then
  283. ChatBubble.SetTheme(info)
  284. break
  285. end
  286. end
  287. return
  288. end
  289. ChatBubble.theme_info = theme_info
  290. ChatBubble.background_color = theme_info.Background
  291. ChatBubble.font = LoadFont(ChatBubble.FONT_DEFAULT, theme_info.Foreground)
  292. print("Theme has been set to "..theme_info.Name.." in ChatBubble")
  293. end
  294.  
  295. do
  296. local floor = math.floor
  297. local max = math.max
  298. local asc = string.byte
  299. local chr = string.char
  300. local find = string.find
  301. local gmatch = string.gmatch
  302. local sub = string.sub
  303. local insert = table.insert
  304. local type = type
  305. local unpack = unpack
  306.  
  307. local PopIntegerBit
  308.  
  309. TextAlignment = setmetatable({
  310. [0] = 0,
  311. [1] = 1,
  312. [2] = 2,
  313. Left = 0,
  314. Center = 1,
  315. Right = 2
  316. }, {
  317. __call = function(self, ...)
  318. local argc = #{...}
  319. if argc == 0 then
  320. return 0
  321. else
  322. local arg = (...)
  323. local value = rawget(self, arg)
  324. if value then
  325. return value
  326. else
  327. local arg_type = type(arg)
  328. error("Invalid value" .. ((arg_type == "number") and (" " .. arg) or ((arg_type == "string") and (" \"" .. arg .. "\"") or
  329.  
  330. "")) .. " for enum TextAlignment")
  331. end
  332. end
  333. end
  334. })
  335.  
  336. function PopIntegerBit(value, bit)
  337. if value >= bit then
  338. return 1, value - bit
  339. else
  340. return 0, value
  341. end
  342. end
  343. function MusicList()
  344.  
  345. end
  346. function LoadFixedFont(dest, src, height, width)
  347. local n = #src / 64 - 1
  348. local bit_index = 0
  349. local symbol_bits = width * height
  350. for i = 0, 255 do
  351. local char_data = {}
  352. for j = 1, height do
  353. char_data[j] = {}
  354. end
  355. dest[i] = char_data
  356. end
  357. for i = 1, #src do
  358. local buffer = tonumber(sub(src, i, i), 16)
  359. for j = 1, 4 do
  360. local code = floor(bit_index / symbol_bits)
  361. local row = floor(bit_index / width) % height + 1
  362. local column = bit_index % width + 1
  363. dest[code][row][column], buffer = PopIntegerBit(buffer, 8)
  364. buffer = buffer * 2
  365. bit_index = bit_index + 1
  366. end
  367. end
  368. end
  369. function LoadFont(font_data, color)
  370. local font_obj = {}
  371. for character, char_data in pairs(font_data) do
  372. local code = character
  373. if type(code) ~= "number" then
  374. code = asc(character)
  375. end
  376. local height = #char_data
  377. local width = #char_data[1]
  378. local pixel_h = 1 / height
  379. local pixel_w = 1 / width
  380. local pixel_size = UDim2.new(pixel_w, 0, pixel_h, 0)
  381. local frame = Instance.new("Frame")
  382. frame.BackgroundTransparency = 1
  383. frame.Name = ""
  384. for y = 1, height do
  385. local row = char_data[y]
  386. for x = 1, width do
  387. local opacity = row[x]
  388. if opacity ~= 0 then
  389. local pixel = Instance.new("Frame", frame)
  390. pixel.BackgroundColor3 = color
  391. pixel.BorderSizePixel = 0
  392. pixel.Name = ""
  393. pixel.Position = UDim2.new(x * pixel_w, 0, y * pixel_h, 0) - pixel_size
  394. pixel.Size = pixel_size -- + UDim2.new(0, 0, 0, 1) -- correction
  395. -- ^ never mind that correction, fixed by changing font size to 12x16 instead of 13x17
  396. if opacity then
  397. pixel.BackgroundTransparency = 1 - opacity
  398. end
  399. end
  400. end
  401. end
  402. font_obj[code] = {frame, height, width}
  403. end
  404. return font_obj
  405. end
  406. function DrawTextNetwork(text, font, size, delay_offset)
  407. if #text == 0 then
  408. text = " "
  409. end
  410. local frame = Instance.new("Frame")
  411. frame.BackgroundTransparency = 1
  412. frame.BorderSizePixel = 0
  413. local objects = {}
  414. local length = #text
  415. local height = 0
  416. local width = 0
  417. for i = 1, length do
  418. local character = sub(text, i, i)
  419. local code = asc(character)
  420. local char_data = assert(font[code] or FONT_SYMBOL_MISSING, "FONT ERROR: '" .. character .. "' (" .. code .. ") not found")
  421. local char_proto, char_h, char_w = unpack(char_data)
  422. objects[i] = char_data
  423. height = max(char_h, height)
  424. width = width + char_w
  425. end
  426. local offset = 0
  427. local punctuation_delay = 0
  428. for i = 1, length do
  429. delay(delay_offset + (i + punctuation_delay - 1) / 30, function()
  430. local char_data = objects[i]
  431. local char_proto, char_h, char_w = unpack(char_data)
  432. local char_obj = char_proto:Clone()
  433. char_obj.Position = UDim2.new(offset / width, 0, 0, 0)
  434. char_obj.Size = UDim2.new(char_w / width, 0, 1, 0)
  435. char_obj.Parent = frame
  436. offset = offset + char_w
  437. end)
  438. local character = sub(text, i, i)
  439. if character == "." then
  440. punctionation_delay = punctuation_delay + 3
  441. elseif character == "?" or character == "!" then
  442. punctionation_delay = punctuation_delay + 2
  443. elseif character == ";" or character == "~" then
  444. punctionation_delay = punctuation_delay + 1
  445. end
  446. end
  447. local ratio = (height == 0) and (0) or (width / height)
  448. frame.Size = UDim2.new(size.X.Scale * ratio, size.X.Offset * ratio, size.Y.Scale, size.Y.Offset)
  449. return frame, height, width, (length + punctuation_delay) / 30
  450. end
  451. function DrawMultilineTextNetwork(text, font, size, delay_offset, ...)
  452. local align = TextAlignment(...)
  453. local frame = Instance.new("Frame")
  454. frame.BackgroundTransparency = 1
  455. frame.BorderSizePixel = 0
  456. local height = 0
  457. local width = 0
  458. local objects = {}
  459. for line in gmatch(text .. "\n", "([^\n]*)\n") do
  460. local line_obj, line_h, line_w, line_delay = DrawTextNetwork(line, font, size, delay_offset)
  461. insert(objects, {line_obj, line_h, line_w})
  462. height = height + line_h
  463. width = max(line_w, width)
  464. delay_offset = delay_offset + line_delay
  465. end
  466. local offset = 0
  467. for index, line_data in ipairs(objects) do
  468. local line_obj, line_h, line_w = unpack(line_data)
  469. local align_offset
  470. if align == TextAlignment.Left then
  471. align_offset = 0
  472. elseif align == TextAlignment.Center then
  473. align_offset = 0.5 - line_w / width / 2
  474. elseif align == TextAlignment.Right then
  475. align_offset = 1 - line_w / width
  476. end
  477. line_obj.Position = UDim2.new(align_offset, 0, offset / height, 0)
  478. line_obj.Parent = frame
  479. offset = offset + line_h
  480. end
  481. local line_count = #objects
  482. local ratio = (height == 0) and (0) or (line_count * width / height)
  483. frame.Size = UDim2.new(size.X.Scale * ratio, size.X.Offset * ratio, size.Y.Scale * line_count, size.Y.Offset * line_count)
  484. return frame, height, width
  485. end
  486. end
  487.  
  488. LoadFixedFont(FONT_CUSTOM_A, FONT_CUSTOM_A_SRC, 8, 6)
  489. ChatBubble.FONT_DEFAULT = FONT_CUSTOM_A
  490. ChatBubble.SetTheme("Rainbow")
  491.  
  492. chat_bubbles = {}
  493.  
  494. function CreateChatBubble(bubble_info)
  495. local creation_time, text, backup = bubble_info[1], bubble_info[2], bubble_info[8]
  496. local billboard, frame, label
  497. if backup and false then
  498. billboard = backup:Clone()
  499. frame = billboard.Frame
  500. label = frame.Label
  501. bubble_info[5] = billboard
  502. bubble_info[6] = frame
  503. bubble_info[7] = label
  504. billboard.Parent = Workspace
  505. else
  506. label = DrawMultilineTextNetwork(text, bubble_info[9], UDim2.new(0, 12, 0, 16), creation_time - time(), "Center")
  507. label.Name = "Label"
  508. label.Position = UDim2.new(0, 16, 0, 16)
  509. billboard = Instance.new("BillboardGui", Workspace)
  510. billboard.Adornee = chatAdornee
  511. billboard.AlwaysOnTop = true
  512. billboard.Size = UDim2.new(label.Size.X.Scale, label.Size.X.Offset + 32, label.Size.Y.Scale, label.Size.Y.Offset + 32)
  513. billboard.SizeOffset = Vector2.new(0, 0)
  514. billboard.StudsOffset = Vector3.new(0, 1, 0)
  515. frame = Instance.new("Frame", billboard)
  516. bubble_info[5] = billboard
  517. bubble_info[6] = frame
  518. bubble_info[7] = label
  519. local background_color = bubble_info[10]
  520. if type(background_color) == "function" then
  521. background_color(bubble_info)
  522. else
  523. frame.BackgroundColor3 = background_color
  524. end
  525. frame.BackgroundTransparency = 0.3
  526. frame.BorderSizePixel = 0
  527. frame.ClipsDescendants = true
  528. frame.Name = "Frame"
  529. frame.Size = UDim2.new(1, 0, 0, 0)
  530. label.Parent = frame
  531. -- bubble_info[8] = billboard:Clone()
  532. end
  533. end
  534. local tween_time = 0.3
  535. function ConfigureChatBubble(bubble_info)
  536. local creation_time, destruction_time, billboard, frame = bubble_info[1], bubble_info[3], bubble_info[5], bubble_info[6]
  537. if not billboard or billboard.Parent ~= workspace then
  538. CreateChatBubble(bubble_info)
  539. billboard, frame = bubble_info[5], bubble_info[6]
  540. end
  541. if billboard.Adornee ~= chatAdornee then
  542. billboard.Adornee = chatAdornee
  543. end
  544. local current_time = time()
  545. local elapsed_time = current_time - creation_time
  546. local remaining_time = destruction_time - current_time
  547. if remaining_time < 0 then
  548. bubble_info[4] = false
  549. billboard:Destroy()
  550. return false
  551. elseif remaining_time < tween_time then
  552. local tween_progress = math.sin(remaining_time * math.pi / (tween_time * 2))
  553. frame.Size = UDim2.new(1, 0, tween_progress, 0)
  554. elseif elapsed_time < tween_time then
  555. local tween_progress = math.sin(elapsed_time * math.pi / (tween_time * 2))
  556. frame.Size = UDim2.new(1, 0, tween_progress, 0)
  557. elseif frame.Size ~= UDim2.new(1, 0, 1, 0) then
  558. frame.Size = UDim2.new(1, 0, 1, 0)
  559. end
  560. return true
  561. end
  562. function ChatBubble.MainLoop()
  563. local offset = 0
  564. local removing = {}
  565. for index, bubble_info in ipairs(chat_bubbles) do
  566. if not ConfigureChatBubble(bubble_info) then
  567. removing[#removing + 1] = index - #removing
  568. else
  569. local billboard, frame = bubble_info[5], bubble_info[6]
  570. local billboard_h = billboard.Size.Y.Offset
  571. local bubble_h = frame.Size.Y.Scale * billboard_h
  572. offset = 8 + offset + bubble_h
  573. billboard.SizeOffset = Vector2.new(0, offset / billboard_h - 0.5)
  574. end
  575. end
  576. for index, bubble_index in ipairs(removing) do
  577. table.remove(chat_bubbles, bubble_index)
  578. end
  579. RunService.Stepped:wait()
  580. end
  581. function WrapText(text, character_limit, line_length_limit)
  582. if #text > character_limit then
  583. text = string.sub(text, 1, character_limit - 3) .. "..."
  584. end
  585. local text_length = #text
  586. local line_length = 0
  587. local i = 0
  588. while i <= text_length do
  589. i = i + 1
  590. local character = string.sub(text, i, i)
  591. if character == "\t" then
  592. local tabulation_size = 4 - line_length % 4
  593. line_length = line_length + tabulation_size
  594. if line_length >= line_length_limit then
  595. tabulation_size = line_length - line_length_limit
  596. line_length = 0
  597. text_length = text_length + tabulation_size
  598. text = string.sub(text, 1, i - 1) .. string.rep(" ", tabulation_size) .. "\n" .. string.sub(text, i + 1)
  599. i = i + tabulation_size + 1
  600. else
  601. text_length = text_length + tabulation_size - 1
  602. text = string.sub(text, 1, i - 1) .. string.rep(" ", tabulation_size) .. string.sub(text, i + 1)
  603. i = i + tabulation_size - 1
  604. end
  605. elseif character == "\n" then
  606. line_length = 0
  607. else
  608. line_length = line_length + 1
  609. if line_length >= line_length_limit then
  610. local k = i - line_length + 1
  611. local success = false
  612. for j = i, k, -1 do
  613. if string.match(string.sub(text, j, j), "[ \t]") then
  614. text = string.sub(text, 1, j - 1) .. "\n" .. string.sub(text, j + 1)
  615. text_length = text_length + 1
  616. success = true
  617. break
  618. end
  619. end
  620. if not success then
  621. text = string.sub(text, 1, i) .. "\n" .. string.sub(text, i + 1)
  622. text_length = text_length + 1
  623. end
  624. i = i + 1
  625. line_length = 0
  626. end
  627. end
  628. end
  629. if #text > character_limit then
  630. text = string.sub(text, 1, character_limit - 3) .. "..."
  631. end
  632. return text
  633. end
  634. function ChatBubble.Create(text, theme)
  635. local text = WrapText(text, 200, 30)
  636. local creation_time = time()
  637. local bubble_info = {creation_time, text, creation_time + 6 + #text / 15, true}
  638. local previousTheme
  639. if theme then
  640. previousTheme = ChatBubble.GetTheme()
  641. ChatBubble.SetTheme(theme)
  642. end
  643. bubble_info[9] = ChatBubble.font
  644. bubble_info[10] = ChatBubble.background_color
  645. if previousTheme then
  646. ChatBubble.SetTheme(previousTheme)
  647. end
  648. table.insert(chat_bubbles, 1, bubble_info)
  649. end
  650. TaskScheduler.Start(function()
  651. while true do
  652. ChatBubble.MainLoop()
  653. end
  654. end)
  655.  
  656. PyramidCharacter = {};
  657.  
  658. local stock_triangle = Instance.new("WedgePart")
  659. stock_triangle.Anchored = true
  660. stock_triangle.BottomSurface = "Smooth"
  661. stock_triangle.FormFactor = "Custom"
  662. stock_triangle.Locked = true
  663. stock_triangle.TopSurface = "Smooth"
  664. local stock_triangle_mesh = Instance.new("SpecialMesh", stock_triangle)
  665. stock_triangle_mesh.MeshType = "Wedge"
  666. local triangles = {}
  667. function PyramidCharacter.CreateTriangle(v1, v2, v3, properties, parent, index)
  668. local triangleInfo = triangles[index]
  669. local side1 = (v1 - v2).magnitude
  670. local side2 = (v2 - v3).magnitude
  671. local side3 = (v3 - v1).magnitude
  672. local sqrside1 = side1 * side1
  673. local sqrside2 = side2 * side2
  674. local sqrside3 = side3 * side3
  675. if sqrside3 + sqrside1 == sqrside2 then
  676. v1, v2, v3 = v1, v2, v3
  677. elseif sqrside1 + sqrside2 == sqrside3 then
  678. v1, v2, v3 = v2, v3, v1
  679. elseif sqrside2 + sqrside3 == sqrside1 then
  680. v1, v2, v3 = v3, v1, v2
  681. elseif sqrside1 >= sqrside2 and sqrside1 >= sqrside3 then
  682. v1, v2, v3 = v1, v2, v3
  683. elseif sqrside2 >= sqrside3 and sqrside2 >= sqrside1 then
  684. v1, v2, v3 = v2, v3, v1
  685. else
  686. v1, v2, v3 = v3, v1, v2
  687. end
  688. local model, part1, part2, mesh1, mesh2
  689. if triangleInfo then
  690. model, part1, part2, mesh1, mesh2 = unpack(triangleInfo)
  691. if not (model.Parent == parent and part1.Parent == model and part2.Parent == model and mesh1.Parent == part1 and mesh2.Parent == part2) then
  692. if model.Parent then
  693. model:Destroy()
  694. end
  695. model = nil
  696. end
  697. else
  698. triangleInfo = {}
  699. triangles[index] = triangleInfo
  700. end
  701. if not model then
  702. model = Instance.new("Model")
  703. part1 = stock_triangle:Clone()
  704. part2 = stock_triangle:Clone()
  705. mesh1 = part1.Mesh
  706. mesh2 = part2.Mesh
  707. part1.Parent = model
  708. part2.Parent = model
  709. triangleInfo[1] = model
  710. triangleInfo[2] = part1
  711. triangleInfo[3] = part2
  712. triangleInfo[4] = mesh1
  713. triangleInfo[5] = mesh2
  714. end
  715. for key, value in pairs(properties) do
  716. part1[key] = value
  717. part2[key] = value
  718. end
  719. local cframe = CFrame.new(v1, v2)
  720. local relpos = cframe:pointToObjectSpace(v3)
  721. cframe = cframe * CFrame.fromEulerAnglesXYZ(0, 0, -math.atan2(relpos.x, relpos.y))
  722. local rel1 = cframe:pointToObjectSpace(v1)
  723. local rel2 = cframe:pointToObjectSpace(v2)
  724. local rel3 = cframe:pointToObjectSpace(v3)
  725. local height = rel3.y
  726. local width1 = rel3.z
  727. local width2 = rel2.z - rel3.z
  728. local relcenter1 = Vector3.new(0, height / 2, width1 / 2)
  729. local center1 = cframe:pointToWorldSpace(relcenter1)
  730. local relcenter2 = Vector3.new(0, height / 2, width2 / 2 + width1)
  731. local center2 = cframe:pointToWorldSpace(relcenter2)
  732. height = math.abs(height)
  733. width1 = math.abs(width1)
  734. width2 = math.abs(width2)
  735. if not part1.Anchored then
  736. part1.Anchored = true
  737. end
  738. part1.Size = Vector3.new(0.2, height, width1)
  739. part1.CFrame = cframe * CFrame.fromEulerAnglesXYZ(0, math.pi, 0) - cframe.p + center1
  740. mesh1.Scale = Vector3.new(0, height / part1.Size.y, width1 / part1.Size.z)
  741. if not part2.Anchored then
  742. part2.Anchored = true
  743. end
  744. part2.Size = Vector3.new(0.2, height, width1)
  745. part2.CFrame = cframe - cframe.p + center2
  746. mesh2.Scale = Vector3.new(0, height / part1.Size.y, width2 / part2.Size.z)
  747. model.Parent = parent
  748. return model
  749. end
  750. PyramidCharacter.head_properties = {BrickColor = BrickColor.new(Color3.new(1, 1, 1)), Transparency = 0.5}
  751. PyramidCharacter.head_radius = math.pi
  752. PyramidCharacter.center = CFrame.new(0, 10, 0)
  753. PyramidCharacter.point1 = Vector3.new()
  754. PyramidCharacter.point2 = Vector3.new()
  755. PyramidCharacter.point3 = Vector3.new()
  756. PyramidCharacter.point4 = Vector3.new()
  757. PyramidCharacter.core_mesh_scale = Vector3.new(0.833, 0.833, 0.833)
  758. PyramidCharacter.visible = false
  759. function PyramidCharacter.Teleport(location)
  760. PyramidCharacter.point1 = location
  761. PyramidCharacter.point2 = location
  762. PyramidCharacter.point3 = location
  763. PyramidCharacter.point4 = location
  764. end
  765. local stock_core = Instance.new("Part")
  766. stock_core.Anchored = true
  767. stock_core.BottomSurface = "Smooth"
  768. stock_core.Color = Color3.new(1, 1, 1)
  769. stock_core.FormFactor = "Custom"
  770. stock_core.Locked = true
  771. stock_core.Name = "CubePyramid"
  772. stock_core.Size = Vector3.new(0.5, 0.5, 0.5)
  773. stock_core.TopSurface = "Smooth"
  774. PyramidCharacter.stock_core = stock_core
  775. PyramidCharacter.core = stock_core:Clone()
  776. PyramidCharacter.Archivable = false
  777. PyramidCharacter.core_mesh = Instance.new("BlockMesh", core)
  778. PyramidCharacter.core_lights = {}
  779. PyramidCharacter.coreLightCount = 1
  780. for index = 1, PyramidCharacter.coreLightCount do
  781. PyramidCharacter.core_lights[index] = Instance.new("PointLight", core)
  782. end
  783. PyramidCharacter.camera_distance = (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude
  784. PyramidCharacter.camera_position = Vector3.new()
  785. Camera.Changed:connect(function(property)
  786. if PyramidCharacter.visible then
  787. if property == "CoordinateFrame" then
  788. local cframe, focus = Camera.CoordinateFrame, Camera.Focus
  789. local eventTime = time()
  790. local connection
  791. connection = Camera.Changed:connect(function()
  792. connection:disconnect()
  793. if eventTime == time() and Camera.Focus ~= focus then
  794. local camera_distance = PyramidCharacter.camera_distance
  795. Camera.Focus = Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)
  796. PyramidCharacter.camera_position = (Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)).p
  797. end
  798. end)
  799. coroutine.yield()
  800. if Camera.Focus == focus then
  801. PyramidCharacter.camera_distance = (focus.p - cframe.p).magnitude
  802. else
  803. local camera_distance = PyramidCharacter.camera_distance
  804. Camera.Focus = Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)
  805. PyramidCharacter.camera_position = (Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)).p
  806. end
  807. if connection.connected then
  808. connection:disconnect()
  809. end
  810. end
  811. end
  812. end)
  813. function PyramidCharacter.Animate()
  814. local total_time = time()
  815. local core = PyramidCharacter.core
  816. local frame = PyramidCharacter.frame
  817. if PyramidCharacter.visible then
  818. local core_mesh = PyramidCharacter.core_mesh
  819. local core_lights = PyramidCharacter.core_lights
  820. if not frame or frame.Parent ~= core then
  821. frame = Instance.new("Model")
  822. frame.Archivable = false
  823. frame.Parent = core
  824. PyramidCharacter.frame = frame
  825. end
  826. if core.Parent ~= Workspace then
  827. core = PyramidCharacter.stock_core:Clone()
  828. PyramidCharacter.core = core
  829. core.Archivable = false
  830. core.Parent = Workspace
  831. chatAdornee = core
  832. end
  833. if core_mesh.Parent ~= core then
  834. core_mesh = Instance.new("BlockMesh", core)
  835. PyramidCharacter.core_mesh = core_mesh
  836. end
  837. for index, core_light in ipairs(core_lights) do
  838. if core_light.Parent ~= core then
  839. core_light = Instance.new("PointLight", core)
  840. core_lights[index] = core_light
  841. end
  842. local vertexColor = Vector3.new(Utility.GetRainbowRGB(total_time)) * 0.25 + Vector3.new(1, 1, 1) * 0.75
  843. core_light.Color = Color3.new(vertexColor.X, vertexColor.Y, vertexColor.Z)
  844. core_light.Brightness = 0.85 + 0.15 * math.random()
  845. if core_light.Range ~= 30 then
  846. core_light.Range = 30
  847. end
  848. if not core_light.Shadows then
  849. core_light.Shadows = true
  850. end
  851. end
  852. if core_mesh.Offset ~= Vector3.new(0, 0, 0) then
  853. core_mesh.Offset = Vector3.new(0, 0, 0)
  854. end
  855. if not core.Anchored then
  856. core.Anchored = true
  857. end
  858. if core.Transparency ~= 0 then
  859. core.Transparency = 0
  860. end
  861. local core_mesh_scale = PyramidCharacter.core_mesh_scale
  862. local transition_speed = (math.sin(total_time * math.tau) + 1) / 16
  863. 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()
  864.  
  865. * 0.5 + 0.5) * transition_speed
  866. core_mesh.Scale = core_mesh_scale * 2
  867. local center = CFrame.new(PyramidCharacter.camera_position) * CFrame.Angles(0, total_time * math.tau, 0)
  868. local cframe1 = CFrame.new(PyramidCharacter.head_radius, 0, 0)
  869. local cframe2 = CFrame.Angles(math.tau / -3, 0, 0)
  870. local cframe3 = CFrame.Angles(0, math.tau / 3, 0)
  871. local cframe4 = center * cframe3
  872. local desired1 = center * CFrame.new(0, PyramidCharacter.head_radius, 0)
  873. local desired2 = center * cframe2 * cframe1
  874. local desired3 = cframe4 * cframe2 * cframe1
  875. local desired4 = cframe4 * cframe3 * cframe2 * cframe1
  876. local point1 = (PyramidCharacter.point1 * 3 + desired1.p) / 4
  877. local point2 = (PyramidCharacter.point2 * 3 + desired2.p) / 4
  878. local point3 = (PyramidCharacter.point3 * 3 + desired3.p) / 4
  879. local point4 = (PyramidCharacter.point4 * 3 + desired4.p) / 4
  880. PyramidCharacter.point1 = point1
  881. PyramidCharacter.point2 = point2
  882. PyramidCharacter.point3 = point3
  883. PyramidCharacter.point4 = point4
  884. local head_properties = PyramidCharacter.head_properties
  885. PyramidCharacter.CreateTriangle(point1, point2, point3, head_properties, frame, 1).Archivable = false
  886. PyramidCharacter.CreateTriangle(point2, point3, point4, head_properties, frame, 2).Archivable = false
  887. PyramidCharacter.CreateTriangle(point3, point4, point1, head_properties, frame, 3).Archivable = false
  888. PyramidCharacter.CreateTriangle(point4, point1, point2, head_properties, frame, 4).Archivable = false
  889. core.CFrame = CFrame.new((point1 + point2 + point3 + point4) / 4) * CFrame.Angles(total_time * math.tau, total_time * math.tau / 2,
  890.  
  891. total_time * math.tau / 3)
  892. PyramidCharacter.center = center
  893. else
  894. if core.Parent then
  895. core:Destroy()
  896. end
  897. if frame and frame.Parent then
  898. frame:Destroy()
  899. end
  900. PyramidCharacter.frame = nil
  901. end
  902. end
  903. function PyramidCharacter.MainLoop()
  904. PyramidCharacter.Animate()
  905. RunService.Stepped:wait()
  906. end
  907. TaskScheduler.Start(function()
  908. while true do
  909. PyramidCharacter.MainLoop()
  910. end
  911. end)
  912.  
  913. RBXInstance = {};
  914.  
  915. RBXInstance.init_metatable = {}
  916. function RBXInstance.init_metatable:__call(data)
  917. local instance = Instance.new(self[1])
  918. for key, value in pairs(data) do
  919. if type(key) == "number" then
  920. value.Parent = instance
  921. else
  922. instance[key] = value
  923. end
  924. end
  925. return instance
  926. end
  927. function RBXInstance.new(className)
  928. return setmetatable({className}, RBXInstance.init_metatable)
  929. end
  930.  
  931. Utility = {};
  932.  
  933. function Utility.CleanLighting()
  934. Lighting.Ambient = Color3.new(0, 0, 0)
  935. Lighting.Brightness = 1
  936. Lighting.ColorShift_Bottom = Color3.new(0, 0, 0)
  937. Lighting.ColorShift_Top = Color3.new(0, 0, 0)
  938. Lighting.FogColor = Color3.new(0.75294125080109, 0.75294125080109, 0.75294125080109)
  939. Lighting.FogEnd = 100000
  940. Lighting.FogStart = 0
  941. Lighting.GeographicLatitude = 41.733299255371095
  942. Lighting.GlobalShadows = true
  943. Lighting.OutdoorAmbient = Color3.new(0.5, 0.5, 0.5)
  944. Lighting.Outlines = false
  945. Lighting.ShadowColor = Color3.new(0.70196080207825, 0.70196080207825, 0.72156864404678)
  946. Lighting.TimeOfDay = "14:00:00"
  947. for index, child in ipairs(Lighting:GetChildren()) do
  948. if child:IsA("Sky") then
  949. child:Destroy()
  950. end
  951. end
  952. end
  953.  
  954. function Utility.GetProperty(object, field)
  955. return object[field]
  956. end
  957.  
  958. function Utility.CaseInsensitivePattern(pattern)
  959. return string.gsub(pattern, "(%%?)(.)", Utility.CaseInsensitivePatternReplaceFunc)
  960. end
  961. function Utility.CaseInsensitivePatternReplaceFunc(percent, letter)
  962. if percent ~= "" or not letter:match("%a") then
  963. return percent .. letter
  964. else
  965. return "[" .. string.lower(letter) .. string.upper(letter) .. "]"
  966. end
  967. end
  968. function Utility.FindHumanoidClosestToRay(ray, exlusionList)
  969. local view = CFrame.new(ray.Origin, ray.Origin + ray.Direction)
  970. local inverseView = view:inverse()
  971. local objects = Workspace:GetChildren()
  972. local numObjects = #objects
  973. local minDistance = math.huge
  974. local closestHumanoid, closestTorso, closestTorsoPosition
  975. for index, object in ipairs(objects) do
  976. for index, child in ipairs(object:GetChildren()) do
  977. numObjects = numObjects + 1
  978. objects[numObjects] = child
  979. end
  980. if object.ClassName == "Humanoid" and object.Health > 0 then
  981. local torso = object.Torso
  982. if torso and not (exlusionList and exlusionList[torso]) then
  983. local torsoPosition = torso.Position
  984. local relativePosition = inverseView * torsoPosition
  985. local distanceZ = -relativePosition.Z
  986. if distanceZ > 0 then
  987. local distance = (inverseView * torsoPosition * Vector3.new(1, 1, 0)).magnitude / distanceZ
  988. if distance < 0.25 and distance < minDistance then
  989. closestHumanoid = object
  990. closestTorso = torso
  991. closestTorsoPosition = torsoPosition
  992. minDistance = distance
  993. end
  994. end
  995. end
  996. end
  997. end
  998. return closestHumanoid, closestTorso, closestTorsoPosition, minDistance
  999. end
  1000. function Utility.FindLocalHead()
  1001. if Player then
  1002. local head, position, view
  1003. pcall(function()
  1004. position = Camera.Focus.p
  1005. view = Camera.CoordinateFrame
  1006. end)
  1007. pcall(function()
  1008. for _, child in ipairs(Workspace:GetChildren()) do
  1009. if Players:GetPlayerFromCharacter(child) == Player then
  1010. for _, child in ipairs(child:GetChildren()) do
  1011. if tostring(child) == "Head" and pcall(assert, pcall(Game.IsA, child, "BasePart")) then
  1012. head = child
  1013. break
  1014. end
  1015. end
  1016. break
  1017. end
  1018. end
  1019. if not head and view then
  1020. local min_distance = math.huge
  1021. local objects = Workspace:GetChildren()
  1022. for _, object in ipairs(objects) do
  1023. local success, is_part = pcall(Game.IsA, object, "BasePart")
  1024. if success and is_part then
  1025. pcall(function()
  1026. local distance = (view:pointToObjectSpace(object.Position) * Vector3.new(1, 1, 0)).magnitude
  1027. if distance < min_distance and distance < 1 then
  1028. min_distance = distance
  1029. head = object
  1030. elseif tostring(object) == "Head" and tostring(object.Parent):lower():match("^" .. tostring(Player):lower()) then
  1031. min_distance = 0
  1032. head = object
  1033. end
  1034. end)
  1035. if min_distance < 5e-4 then
  1036. break
  1037. end
  1038. end
  1039. pcall(function()
  1040. if not object:IsA("Camera") then
  1041. for _, child in ipairs(object:GetChildren()) do
  1042. objects[#objects + 1] = child
  1043. end
  1044. end
  1045. end)
  1046. end
  1047. end
  1048. end)
  1049. return head, position, view
  1050. end
  1051. end
  1052. function Utility.GetBuildingTools()
  1053. local backpack = Player:FindFirstChild("Backpack")
  1054. if backpack then
  1055. local moveTool = Instance.new("HopperBin")
  1056. local cloneTool = Instance.new("HopperBin")
  1057. local deleteTool = Instance.new("HopperBin")
  1058. moveTool.BinType = Enum.BinType.GameTool
  1059. cloneTool.BinType = Enum.BinType.Clone
  1060. deleteTool.BinType = Enum.BinType.Hammer
  1061. moveTool.Parent = backpack
  1062. cloneTool.Parent = backpack
  1063. deleteTool.Parent = backpack
  1064. end
  1065. end
  1066. function Utility.Rejoin()
  1067. Workspace.Parent:service'TeleportService':Teleport(Game.PlaceId)
  1068. end
  1069.  
  1070. function Utility.BlockRobloxFilter(text)
  1071. return string.gsub(text, ".", "%1\143")
  1072. end
  1073.  
  1074. function Utility.GetTimestamp()
  1075. local unix_time = tick()
  1076. local time_secs = math.floor(unix_time % 60)
  1077. local time_mins = math.floor(unix_time / 60 % 60)
  1078. local time_hours = math.floor(unix_time / 3600 % 24)
  1079. return string.format("%02i:%02i:%02i", time_hours, time_mins, time_secs)
  1080. end
  1081.  
  1082. function Utility.GetRainbowRGB(hue)
  1083. local section = hue % 1 * 3
  1084. local secondary = 0.5 * math.pi * (section % 1)
  1085. if section < 1 then
  1086. return 1, 1 - math.cos(secondary), 1 - math.sin(secondary)
  1087. elseif section < 2 then
  1088. return 1 - math.sin(secondary), 1, 1 - math.cos(secondary)
  1089. else
  1090. return 1 - math.cos(secondary), 1 - math.sin(secondary), 1
  1091. end
  1092. end
  1093.  
  1094. function Utility.SetProperty(object, field, value)
  1095. object[field] = value
  1096. end
  1097.  
  1098. function Utility.CleanWorkspace()
  1099. for index, child in ipairs(Workspace:GetChildren()) do
  1100. if not (Players:GetPlayerFromCharacter(child) or child.ClassName == "Camera" or child:IsA("Script") or child.ClassName == "Terrain") then
  1101. pcall(child.Destroy, child)
  1102. end
  1103. end
  1104. Workspace.Terrain:Clear()
  1105. local base = Instance.new("Part")
  1106. base.Anchored = true
  1107. base.BrickColor = BrickColor.new("Earth green")
  1108. base.Locked = true
  1109. base.Name = "Base"
  1110. base.Size = Vector3.new(512, 1.2, 512)
  1111. base.Parent = Workspace
  1112. end
  1113.  
  1114. function Utility.CleanWorkspaceAndScripts()
  1115. for index, child in ipairs(Workspace:GetChildren()) do
  1116. if not (Players:GetPlayerFromCharacter(child) or child.ClassName == "Camera" or child.ClassName == "Terrain") then
  1117. pcall(child.Destroy, child)
  1118. end
  1119. end
  1120. Workspace.Terrain:Clear()
  1121. local base = Instance.new("Part")
  1122. base.Anchored = true
  1123. base.BrickColor = BrickColor.new("Earth green")
  1124. base.Locked = true
  1125. base.Name = "Base"
  1126. base.Size = Vector3.new(512, 1.2, 512)
  1127. base.Parent = Workspace
  1128. end
  1129.  
  1130. function Utility.CreateDummy(cframe, name, parent)
  1131. local model = Instance.new("Model")
  1132. model.Archivable = false
  1133. model.Name = name
  1134. local humanoid = Instance.new("Humanoid", model)
  1135. local head = Instance.new("Part", model)
  1136. local face = Instance.new("Decal", head)
  1137. local head_mesh = Instance.new("SpecialMesh", head)
  1138. local torso = Instance.new("Part", model)
  1139. local right_arm = Instance.new("Part", model)
  1140. local left_arm = Instance.new("Part", model)
  1141. local right_leg = Instance.new("Part", model)
  1142. local left_leg = Instance.new("Part", model)
  1143. local neck = Instance.new("Motor", torso)
  1144. local right_shoulder = Instance.new("Motor", torso)
  1145. local left_shoulder = Instance.new("Motor", torso)
  1146. local right_hip = Instance.new("Motor", torso)
  1147. local left_hip = Instance.new("Motor", torso)
  1148. head.BrickColor = BrickColor.Yellow()
  1149. head.CFrame = cframe * CFrame.new(0, 1.5, 0)
  1150. head.FormFactor = "Symmetric"
  1151. head.Locked = true
  1152. head.Name = "Head"
  1153. head.Size = Vector3.new(2, 1, 1)
  1154. head.TopSurface = "Smooth"
  1155. face.Texture = "rbxasset://textures/face.png"
  1156. head_mesh.Scale = Vector3.new(1.25, 1.25, 1.25)
  1157. torso.BrickColor = BrickColor.Blue()
  1158. torso.CFrame = cframe
  1159. torso.FormFactor = "Symmetric"
  1160. torso.LeftSurface = "Weld"
  1161. torso.Locked = true
  1162. torso.RightSurface = "Weld"
  1163. torso.Name = "Torso"
  1164. torso.Size = Vector3.new(2, 2, 1)
  1165. right_arm.BrickColor = BrickColor.Yellow()
  1166. right_arm.CanCollide = false
  1167. right_arm.CFrame = cframe * CFrame.new(1.5, 0, 0)
  1168. right_arm.FormFactor = "Symmetric"
  1169. right_arm.Locked = true
  1170. right_arm.Name = "Right Arm"
  1171. right_arm.Size = Vector3.new(1, 2, 1)
  1172. left_arm.BrickColor = BrickColor.Yellow()
  1173. left_arm.CanCollide = false
  1174. left_arm.CFrame = cframe * CFrame.new(-1.5, 0, 0)
  1175. left_arm.FormFactor = "Symmetric"
  1176. left_arm.Locked = true
  1177. left_arm.Name = "Left Arm"
  1178. left_arm.Size = Vector3.new(1, 2, 1)
  1179. right_leg.BrickColor = BrickColor.new("Br. yellowish green")
  1180. right_leg.BottomSurface = "Smooth"
  1181. right_leg.CanCollide = false
  1182. right_leg.CFrame = cframe * CFrame.new(0.5, -2, 0)
  1183. right_leg.FormFactor = "Symmetric"
  1184. right_leg.Locked = true
  1185. right_leg.Name = "Right Leg"
  1186. right_leg.Size = Vector3.new(1, 2, 1)
  1187. right_leg.TopSurface = "Smooth"
  1188. left_leg.BrickColor = BrickColor.new("Br. yellowish green")
  1189. left_leg.BottomSurface = "Smooth"
  1190. left_leg.CanCollide = false
  1191. left_leg.CFrame = cframe * CFrame.new(-0.5, -2, 0)
  1192. left_leg.FormFactor = "Symmetric"
  1193. left_leg.Locked = true
  1194. left_leg.Name = "Left Leg"
  1195. left_leg.Size = Vector3.new(1, 2, 1)
  1196. left_leg.TopSurface = "Smooth"
  1197. neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  1198. neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  1199. neck.Name = "Neck"
  1200. neck.Part0 = torso
  1201. neck.Part1 = head
  1202. right_shoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  1203. right_shoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  1204. right_shoulder.MaxVelocity = 0.15
  1205. right_shoulder.Name = "Right Shoulder"
  1206. right_shoulder.Part0 = torso
  1207. right_shoulder.Part1 = right_arm
  1208. left_shoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  1209. left_shoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  1210. left_shoulder.MaxVelocity = 0.15
  1211. left_shoulder.Name = "Left Shoulder"
  1212. left_shoulder.Part0 = torso
  1213. left_shoulder.Part1 = left_arm
  1214. right_hip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  1215. right_hip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  1216. right_hip.MaxVelocity = 0.1
  1217. right_hip.Name = "Right Hip"
  1218. right_hip.Part0 = torso
  1219. right_hip.Part1 = right_leg
  1220. left_hip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  1221. left_hip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  1222. left_hip.MaxVelocity = 0.1
  1223. left_hip.Name = "Left Hip"
  1224. left_hip.Part0 = torso
  1225. left_hip.Part1 = left_leg
  1226. humanoid.Died:connect(function()
  1227. wait(5)
  1228. model:Destroy()
  1229. end)
  1230. model.Parent = parent
  1231. return model
  1232. end
  1233.  
  1234. Serializer = {};
  1235.  
  1236. Serializer.NAN = math.abs(0 / 0)
  1237.  
  1238. function Serializer.DecodeFloatArray(metadata_size, lookup, data, index)
  1239. local metadata_bytes = math.ceil(metadata_size * 0.25)
  1240. local metadata = {string.byte(data, index, index + metadata_bytes - 1)}
  1241. local components = {}
  1242. local start_index = index
  1243. index = index + metadata_bytes
  1244. for byte_index, byte in ipairs(metadata) do
  1245. local last_offset = 3
  1246. if byte_index == metadata_bytes then
  1247. last_offset = (metadata_size - 1) % 4
  1248. end
  1249. for value_offset = 0, last_offset do
  1250. local value_code = byte * 0.25 ^ value_offset % 4
  1251. value_code = value_code - value_code % 1
  1252. if value_code == 0 then
  1253. table.insert(components, Serializer.DecodeFloat32(string.byte(data, index, index + 3)))
  1254. index = index + 4
  1255. else
  1256. table.insert(components, lookup[value_code])
  1257. end
  1258. end
  1259. end
  1260. return components, index - start_index
  1261. end
  1262. function Serializer.EncodeFloatArray(values, common)
  1263. local lookup = {[common[1]] = 1, [common[2]] = 2, [common[3]] = 3}
  1264. local value_count = #values
  1265. local metadata_bytes = math.ceil(value_count * 0.25)
  1266. local metadata = {}
  1267. local buffer = {}
  1268. for byte_index = 1, metadata_bytes do
  1269. local last_offset = 3
  1270. if byte_index == metadata_bytes then
  1271. last_offset = (value_count - 1) % 4
  1272. end
  1273. local metadata_byte = 0
  1274. local offset_multiplier = 1
  1275. local byte_offset = (byte_index - 1) * 4 + 1
  1276. for value_offset = 0, last_offset do
  1277. local value_index = byte_offset + value_offset
  1278. local value = values[value_index]
  1279. local code = lookup[value] or 0
  1280. metadata_byte = metadata_byte + code * offset_multiplier
  1281. offset_multiplier = offset_multiplier * 4
  1282. if code == 0 then
  1283. table.insert(buffer, Serializer.EncodeFloat32(value))
  1284. end
  1285. end
  1286. metadata[byte_index] = string.char(metadata_byte)
  1287. end
  1288. return table.concat(metadata) .. table.concat(buffer)
  1289. end
  1290.  
  1291. function Serializer.DecodeColor3(data, index)
  1292. local components, size = Serializer.DecodeFloatArray(3, {0, 0.5, 1}, data, index)
  1293. return Color3.new(unpack(components)), size
  1294. end
  1295. function Serializer.DecodeFloat32(b0, b1, b2, b3)
  1296. local b2_low = b2 % 128
  1297. local mantissa = b0 + (b1 + b2_low * 256) * 256
  1298. local exponent = (b2 - b2_low) / 128 + b3 % 128 * 2
  1299. local number
  1300. if mantissa == 0 then
  1301. if exponent == 0 then
  1302. number = 0
  1303. elseif exponent == 0xFF then
  1304. number = math.huge
  1305. else
  1306. number = 2 ^ (exponent - 127)
  1307. end
  1308. elseif exponent == 255 then
  1309. number = Serializer.NAN
  1310. else
  1311. number = (1 + mantissa / 8388608) * 2 ^ (exponent - 127)
  1312. end
  1313. if b3 >= 128 then
  1314. return -number
  1315. else
  1316. return number
  1317. end
  1318. end
  1319. function Serializer.EncodeColor3(color3)
  1320. return Serializer.EncodeFloatArray({color3.r, color3.g, color3.b}, {0, 0.5, 1})
  1321. end
  1322. function Serializer.EncodeFloat32(number)
  1323. if number == 0 then
  1324. if 1 / number > 0 then
  1325. return "\0\0\0\0"
  1326. else
  1327. return "\0\0\0\128"
  1328. end
  1329. elseif number ~= number then
  1330. if string.sub(tostring(number), 1, 1) == "-" then
  1331. return "\255\255\255\255"
  1332. else
  1333. return "\255\255\255\127"
  1334. end
  1335. elseif number == math.huge then
  1336. return "\0\0\128\127"
  1337. elseif number == -math.huge then
  1338. return "\0\0\128\255"
  1339. else
  1340. local b3 = 0
  1341. if number < 0 then
  1342. number = -number
  1343. b3 = 128
  1344. end
  1345. local mantissa, exponent = math.frexp(number)
  1346. exponent = exponent + 126
  1347. if exponent < 0 then
  1348. return "\0\0\0" .. string.char(b3)
  1349. elseif exponent >= 255 then
  1350. return "\0\0\128" .. string.char(b3 + 0x7F)
  1351. else
  1352. local fraction = mantissa * 16777216 - 8388608 + 0.5
  1353. fraction = fraction - fraction % 1
  1354. local exponent_low = exponent % 2
  1355. local b0 = fraction % 256
  1356. local b1 = fraction % 65536
  1357. local b2 = (fraction - b1) / 65536 + exponent_low * 128
  1358. b1 = (b1 - b0) / 256
  1359. b3 = b3 + (exponent - exponent_low) / 2
  1360. return string.char(b0, b1, b2, b3)
  1361. end
  1362. end
  1363. end
  1364.  
  1365. LuaEnum = {};
  1366.  
  1367. LuaEnum.enum_metatable = {
  1368. __call = function(self, value)
  1369. local valueType = type(value)
  1370. if valueType == "table" and getmetatable(value) == LuaEnum.enum_item_metatable then
  1371. return value
  1372. else
  1373. return self[value]
  1374. end
  1375. end,
  1376. __index = function(self, key)
  1377. local enumItem = self.ItemsByName[key] or self.ItemsByValue[key]
  1378. if enumItem == nil then
  1379. local default = self.Default
  1380. if default then
  1381. Logger.printf("Warning", "%s is not a valid EnumItem, returning default (%s)", Utility.ToString(key), tostring(default))
  1382. enumItem = default
  1383. else
  1384. Logger.errorf(2, "%s is not a valid EnumItem", Utility.ToString(key))
  1385. end
  1386. end
  1387. return enumItem
  1388. end,
  1389. __tostring = function(self)
  1390. return self.Name
  1391. end
  1392. }
  1393. LuaEnum.enum_item_metatable = {
  1394. __tostring = function(self)
  1395. return self.Enum.Name .. "." .. self.Name
  1396. end
  1397. }
  1398. LuaEnum.init_metatable = {
  1399. __call = function(self, items)
  1400. local enumItemsByName = {}
  1401. local enumItemsByValue = {}
  1402. local enum = {
  1403. ItemsByName = enumItemsByName,
  1404. ItemsByValue = enumItemsByValue,
  1405. Name = self[1]
  1406. }
  1407. local default = items.Default
  1408. if default ~= nil then
  1409. items.Default = nil
  1410. end
  1411. for value, name in pairs(items) do
  1412. local enumItem = setmetatable({
  1413. Enum = enum,
  1414. Name = name,
  1415. Value = value
  1416. }, LuaEnum.enum_item_metatable)
  1417. enumItemsByName[name] = enumItem
  1418. enumItemsByValue[value] = enumItem
  1419. if name == default or value == default then
  1420. enum.Default = enumItem
  1421. end
  1422. end
  1423. return setmetatable(enum, LuaEnum.enum_metatable)
  1424. end
  1425. }
  1426. function LuaEnum.new(name)
  1427. return setmetatable({name}, LuaEnum.init_metatable)
  1428. end
  1429.  
  1430. Logger = {};
  1431.  
  1432. Logger.entries = {0}
  1433. Logger.MessageType = LuaEnum.new "MessageType" {
  1434. "Output",
  1435. "Info",
  1436. "Warning",
  1437. "Severe",
  1438. "Error",
  1439. Default = "Severe"
  1440. }
  1441. Logger.MESSAGE_TYPE_SETTINGS = {
  1442. { -- Output
  1443. Font = "Arial",
  1444. TextColor3 = Color3.new(0, 0, 0)
  1445. },
  1446. { -- Info
  1447. Font = "Arial",
  1448. TextColor3 = Color3.new(0, 0, 1)
  1449. },
  1450. { -- Warning
  1451. Font = "ArialBold",
  1452. TextColor3 = Color3.new(1, 0.5, 0)
  1453. },
  1454. { -- Severe/Error
  1455. Font = "ArialBold",
  1456. TextColor3 = Color3.new(1, 0, 0)
  1457. }
  1458. }
  1459. Logger.MAX_ENTRIES = 160
  1460. Logger.WARNING_TRACE_ITEM_COUNT = 5
  1461. Logger.rbxPrint = getfenv(RbxUtility.CreateSignal).print
  1462. function Logger.error(level, message)
  1463. message = message .. "\n" .. Logger.StackTraceToString(Logger.GenerateStackTrace(level + 1))
  1464. Logger.AddEntry {Logger.MessageType.Error, message}
  1465. error(level + 1, message)
  1466. end
  1467. function Logger.errorf(level, messageFormat, ...)
  1468. Logger.error(level + 1, string.format(messageFormat, ...))
  1469. end
  1470. function Logger.print(messageType, message, level)
  1471. messageType = Logger.MessageType(messageType)
  1472. local entry = {messageType, message}
  1473. Logger.rbxPrint(Logger.EntryToString(entry))
  1474. Logger.AddEntry(entry)
  1475. if level ~= false and messageType.Value >= Logger.MessageType.Warning.Value then
  1476. local maxItems
  1477. if messageType.Value >= Logger.MessageType.Severe.Value then
  1478. maxItems = math.huge
  1479. else
  1480. maxItems = Logger.WARNING_TRACE_ITEM_COUNT
  1481. end
  1482. local trace = Logger.GenerateStackTrace((level or 1) + 1, math.huge, 10, maxItems + 1)
  1483. local traceLength = #trace
  1484. local stackTraceMessage
  1485. local suffix = ""
  1486. if traceLength > maxItems then
  1487. trace[traceLength] = nil
  1488. suffix = "\n..."
  1489. end
  1490. Logger.print("Info", "Stack trace:\n" .. Logger.StackTraceToString(trace) .. suffix .. "\nStack end", false)
  1491. end
  1492. end
  1493. function Logger.printf(messageType, messageFormat, ...)
  1494. Logger.print(messageType, string.format(messageFormat, ...), 2)
  1495. end
  1496. function Logger.AddEntry(entry)
  1497. local entries = Logger.entries
  1498. if entries[1] >= Logger.MAX_ENTRIES then
  1499. local first = entries[2]
  1500. local nextFirst = first[2]
  1501. first[1] = nil
  1502. first[2] = nil
  1503. entries[1] = entries[1] - 1
  1504. entries[2] = nextFirst
  1505. if not nextFirst then
  1506. entries[3] = nil
  1507. end
  1508. end
  1509. local last = entries[3]
  1510. local node = {entry}
  1511. if last then
  1512. entries[3] = node
  1513. last[2] = node
  1514. else
  1515. entries[2] = node
  1516. entries[3] = node
  1517. end
  1518. entries[1] = entries[1] + 1
  1519. end
  1520. function Logger.NodeIterator(list, node)
  1521. if node then
  1522. node = node[2]
  1523. else
  1524. node = list[2]
  1525. end
  1526. if node then
  1527. return node, node[1]
  1528. end
  1529. end
  1530. function Logger.EntryToString(entry)
  1531. local messageType, message = entry[1], tostring(entry[2])
  1532. if messageType and messageType.Value >= Logger.MessageType.Info.Value then
  1533. return messageType.Name .. ": " .. message
  1534. else
  1535. return message
  1536. end
  1537. end
  1538. function Logger.GenerateStackTrace(level, maxLevel, maxTailCalls, maxTraceItems)
  1539. level = level + 2
  1540. if maxLevel == nil then
  1541. maxLevel = math.huge
  1542. else
  1543. maxLevel = maxLevel + 2
  1544. end
  1545. maxTailCalls = maxTailCalls or 10
  1546. maxTraceItems = maxTraceItems or math.huge
  1547. local trace = {}
  1548. local numTailCalls = 0
  1549. while level <= maxLevel and numTailCalls <= maxTailCalls and #trace < maxTraceItems do
  1550. local success, errorMessage = xpcall(function() error("-", level + 1) end, function(...) return ... end)
  1551. if errorMessage == "-" then
  1552. numTailCalls = numTailCalls + 1
  1553. else
  1554. if numTailCalls > 0 then
  1555. local traceSize = #trace
  1556. if traceSize > 0 then
  1557. trace[#trace][3] = numTailCalls
  1558. end
  1559. numTailCalls = 0
  1560. end
  1561. local script, line = string.match(errorMessage, "(.*):(%d+)")
  1562. trace[#trace + 1] = {script, tonumber(line), 0}
  1563. end
  1564. level = level + 1
  1565. end
  1566. return trace
  1567. end
  1568. function Logger.StackTraceToString(trace)
  1569. local buffer = {}
  1570. for _, data in ipairs(trace) do
  1571. buffer[#buffer + 1] = string.format("Script %q, line %d", data[1], data[2])
  1572. local numTailCalls = data[3]
  1573. if numTailCalls == 1 then
  1574. buffer[#buffer + 1] = "... 1 tail call"
  1575. elseif numTailCalls > 1 then
  1576. buffer[#buffer + 1] = string.format("... %d tail calls", numTailCalls)
  1577. end
  1578. end
  1579. return table.concat(buffer, "\n")
  1580. end
  1581. function Logger.MessageOutFunc(message, messageType)
  1582. if AdvancedGUI and AdvancedGUI.Print then
  1583. local messageTypeValue
  1584. if messageType == Enum.MessageType.MessageOutput then
  1585. local tagName, untaggedMessage = string.match(message, "(%a+): (.*)")
  1586. if tagName == "Info" or tagName == "Warning" or tagName == "Severe" then
  1587. messageTypeValue = Logger.MessageType[tagName].Value
  1588. message = untaggedMessage
  1589. else
  1590. messageTypeValue = Logger.MessageType.Output.Value
  1591. end
  1592. else
  1593. messageTypeValue = messageType.Value + 1
  1594. end
  1595. AdvancedGUI.PrintFormat(Logger.MESSAGE_TYPE_SETTINGS[messageTypeValue], message)
  1596. end
  1597. end
  1598. function print(...)
  1599. local args = {...}
  1600. local buffer = {}
  1601. for index = 1, select("#", ...) do
  1602. buffer[index] = tostring(args[index])
  1603. end
  1604. local message = table.concat(buffer, "\t")
  1605. Logger.print("Output", message)
  1606. end
  1607.  
  1608. CharacterAppearance = {};
  1609.  
  1610. CharacterAppearance.defaultAppearanceId = 2
  1611. CharacterAppearance.stock = {}
  1612. function CharacterAppearance.Create(properties)
  1613. local id = properties.Id
  1614. local bodyColors = Instance.new("BodyColors")
  1615. bodyColors.HeadColor = properties.HeadColor
  1616. bodyColors.TorsoColor = properties.TorsoColor
  1617. bodyColors.RightArmColor = properties.RightArmColor
  1618. bodyColors.LeftArmColor = properties.LeftArmColor
  1619. bodyColors.RightLegColor = properties.RightLegColor
  1620. bodyColors.LeftLegColor = properties.LeftLegColor
  1621. local characterObjects = {bodyColors}
  1622. local headObjects = {}
  1623. local data = {
  1624. characterObjects = characterObjects,
  1625. headObjects = headObjects,
  1626. tshirt = properties.TShirt
  1627. }
  1628. for _, assetId in ipairs(properties.CharacterAssets) do
  1629. TaskScheduler.Start(CharacterAppearance.LoadAsset, characterObjects, assetId)
  1630. end
  1631. for _, assetId in ipairs(properties.HeadAssets) do
  1632. TaskScheduler.Start(CharacterAppearance.LoadAsset, headObjects, assetId)
  1633. end
  1634. CharacterAppearance.stock[id] = data
  1635. end
  1636. function CharacterAppearance.GetDefaultAppearance()
  1637. return CharacterAppearance.stock[CharacterAppearance.defaultAppearanceId]
  1638. end
  1639. function CharacterAppearance.LoadAsset(objects, assetId)
  1640. local asset = InsertService:LoadAsset(assetId)
  1641. for _, child in ipairs(asset:GetChildren()) do
  1642. child.Archivable = true
  1643. table.insert(objects, child:Clone())
  1644. end
  1645. end
  1646. CharacterAppearance.Create {
  1647. Id = 1,
  1648. HeadColor = BrickColor.new("Institutional white"),
  1649. TorsoColor = BrickColor.new("Institutional white"),
  1650. RightArmColor = BrickColor.new("Institutional white"),
  1651. LeftArmColor = BrickColor.new("Institutional white"),
  1652. RightLegColor = BrickColor.new("Institutional white"),
  1653. LeftLegColor = BrickColor.new("Institutional white"),
  1654. CharacterAssets = {
  1655. 90825058, 90825211,
  1656. 27112056, 27112052,
  1657. 27112039, 27112025,
  1658. 27112068, 38322996
  1659. },
  1660. HeadAssets = {
  1661. 20722130,
  1662. 8330576
  1663. }
  1664. }
  1665. CharacterAppearance.Create {
  1666. Id = 2,
  1667. HeadColor = BrickColor.new("Institutional white"),
  1668. TorsoColor = BrickColor.new("Institutional white"),
  1669. RightArmColor = BrickColor.new("Institutional white"),
  1670. LeftArmColor = BrickColor.new("Institutional white"),
  1671. RightLegColor = BrickColor.new("Institutional white"),
  1672. LeftLegColor = BrickColor.new("Institutional white"),
  1673. CharacterAssets = {
  1674. 90825058, 90825211,
  1675. 11748356, 1029025,
  1676. 1235488, 27112056,
  1677. 27112052, 27112039,
  1678. 27112025, 27112068
  1679. },
  1680. HeadAssets = {
  1681. 20722130
  1682. }
  1683. }
  1684. CharacterAppearance.Create {
  1685. Id = 3,
  1686. HeadColor = BrickColor.new("Pastel brown"),
  1687. TorsoColor = BrickColor.new("Pastel brown"),
  1688. RightArmColor = BrickColor.new("Pastel brown"),
  1689. LeftArmColor = BrickColor.new("Pastel brown"),
  1690. RightLegColor = BrickColor.new("White"),
  1691. LeftLegColor = BrickColor.new("White"),
  1692. CharacterAssets = {
  1693. 134289125, 48474356,
  1694. 100339040, 46302558,
  1695. 153955895
  1696. },
  1697. HeadAssets = {},
  1698. TShirt = "rbxassetid://148856353"
  1699. }
  1700. CharacterAppearance.Create {
  1701. Id = 4,
  1702. HeadColor = BrickColor.new("Pastel brown"),
  1703. TorsoColor = BrickColor.new("Pastel brown"),
  1704. RightArmColor = BrickColor.new("Pastel brown"),
  1705. LeftArmColor = BrickColor.new("Pastel brown"),
  1706. RightLegColor = BrickColor.new("White"),
  1707. LeftLegColor = BrickColor.new("White"),
  1708. CharacterAssets = {
  1709. 129458426, 96678344, 184489190
  1710. },
  1711. HeadAssets = {},
  1712. TShirt = "rbxassetid://160146697"
  1713. }
  1714.  
  1715. GraphicalEffects = {};
  1716.  
  1717. local MESH_IDS = {"rbxassetid://15310891"}
  1718. local SOUND_IDS = {"rbxassetid://2248511", "rbxassetid://1369158"}
  1719. local TEXTURE_IDS = {"rbxassetid://36527089", "rbxassetid://122610943", "rbxassetid://126561317", "rbxassetid://127033719"}
  1720. local preloadConnections = {}
  1721. local reloadingPreloads = false
  1722. function GraphicalEffects.InitPreloads()
  1723. local preload_part = Instance.new("Part")
  1724. GraphicalEffects.preload_part = preload_part
  1725. preload_part.Anchored = true
  1726. preload_part.Archivable = false
  1727. preload_part.BottomSurface = "Smooth"
  1728. preload_part.CanCollide = false
  1729. preload_part.CFrame = CFrame.new(math.huge, math.huge, math.huge)
  1730. preload_part.FormFactor = "Custom"
  1731. preload_part.Locked = true
  1732. preload_part.Name = "Asset Preloader"
  1733. preload_part.Size = Vector3.new(0.2, 0.2, 0.2)
  1734. preload_part.TopSurface = "Smooth"
  1735. preload_part.Transparency = 1
  1736. preloadConnections[preload_part] = preload_part.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged)
  1737. for _, mesh_id in ipairs(MESH_IDS) do
  1738. local mesh = Instance.new("SpecialMesh")
  1739. mesh.MeshType = "FileMesh"
  1740. mesh.MeshId = mesh_id
  1741. preloadConnections[mesh] = mesh.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged)
  1742. mesh.Parent = preload_part
  1743. end
  1744. for _, sound_id in ipairs(SOUND_IDS) do
  1745. local sound = Instance.new("Sound")
  1746. sound.SoundId = sound_id
  1747. sound.Volume = 0
  1748. preloadConnections[sound] = sound.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged)
  1749. sound.Parent = preload_part
  1750. end
  1751. for _, texture_id in ipairs(TEXTURE_IDS) do
  1752. local decal = Instance.new("Decal")
  1753. decal.Texture = texture_id
  1754. preloadConnections[decal] = decal.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged)
  1755. decal.Parent = preload_part
  1756. end
  1757. preload_part.Parent = Workspace
  1758. end
  1759. function GraphicalEffects.PreloadsAncestryChanged(child, parent)
  1760. if not reloadingPreloads and parent ~= GraphicalEffects.preload_part and parent ~= Workspace then
  1761. reloadingPreloads = true
  1762. for _, connection in pairs(preloadConnections) do
  1763. connection:disconnect()
  1764. preloadConnections[_] = nil
  1765. end
  1766. wait(1)
  1767. reloadingPreloads = false
  1768. GraphicalEffects.InitPreloads()
  1769. end
  1770. end
  1771. GraphicalEffects.InitPreloads()
  1772. -- Hyper beam
  1773. function GraphicalEffects.FireSpaceHyperBeam(target, power, duration, radius, height, deviation)
  1774. local stepTime, gameTime = 1 / 30, TaskScheduler.GetCurrentTime()
  1775. local frames = duration * 30
  1776. local beamColorOffset = 0.75 * tick() -- math.random()
  1777. local blastPressure = power * 62500 + 250000
  1778. local beamPart = Instance.new("Part")
  1779. local beamMesh = Instance.new("SpecialMesh", beamPart)
  1780. local explosion = Instance.new("Explosion")
  1781. local sound = Instance.new("Sound", beamPart)
  1782. beamPart.Anchored = true
  1783. beamPart.CanCollide = false
  1784. beamPart.CFrame = CFrame.new(target, target + Vector3.new(deviation * (math.random() - 0.5), deviation * (math.random() - 0.5), height))
  1785. beamPart.FormFactor = "Custom"
  1786. beamPart.Locked = true
  1787. beamPart.Size = Vector3.new(0.2, 0.2, 0.2)
  1788. beamMesh.MeshId = "rbxassetid://15310891"
  1789. beamMesh.MeshType = "FileMesh"
  1790. beamMesh.TextureId = "rbxassetid://36527089"
  1791. local beamGlowPart1 = beamPart:Clone()
  1792. local beamGlowMesh1 = beamMesh:Clone()
  1793. local beamGlowPart2 = beamPart:Clone()
  1794. local beamGlowMesh2 = beamMesh:Clone()
  1795. local beamLight = Instance.new("PointLight", beamPart)
  1796. beamLight.Range = power * 2
  1797. beamLight.Shadows = true
  1798. explosion.BlastPressure = blastPressure
  1799. explosion.BlastRadius = power
  1800. explosion.Position = target
  1801. sound.SoundId = "rbxassetid://2248511"
  1802. sound.Volume = 1
  1803. local explosionHitConnection = explosion.Hit:connect(function(part, distance)
  1804. if not part.Anchored and part:GetMass() < power * power then
  1805. pcall(part.BreakJoints, part)
  1806. part.Color = Color3.new(Utility.GetRainbowRGB(1.5 * gameTime + beamColorOffset))
  1807. end
  1808. end)
  1809. beamPart.Transparency = 0.5
  1810. beamPart.Archivable = false
  1811. beamGlowPart1.Transparency = 0.75
  1812. beamGlowPart2.Transparency = 0.75
  1813. beamGlowMesh1.Parent = beamGlowPart1
  1814. beamGlowPart1.Parent = beamPart
  1815. beamGlowMesh2.Parent = beamGlowPart2
  1816. beamGlowPart2.Parent = beamPart
  1817. beamPart.Parent = workspace
  1818. explosion.Parent = workspace
  1819. for frame = 1, frames do
  1820. local progress = frame / frames
  1821. local alpha = 1 - math.sin(0.5 * math.pi * progress)
  1822. local scale = 0.4 * alpha
  1823. local glowScale1 = alpha * (0.5 + 0.5 * math.sin(math.tau * (8 * gameTime + beamColorOffset)))
  1824. local glowScale2 = alpha * (0.5 + 0.5 * math.cos(math.tau * (8 * gameTime + beamColorOffset)))
  1825. local vertexColor = Vector3.new(Utility.GetRainbowRGB(1.5 * gameTime + beamColorOffset))
  1826. beamLight.Brightness = 1 - progress
  1827. beamLight.Color = Color3.new(vertexColor.x, vertexColor.y, vertexColor.z)
  1828. beamMesh.Scale = Vector3.new(radius * scale, 9000, radius * scale)
  1829. beamMesh.VertexColor = vertexColor
  1830. beamGlowMesh1.Scale = Vector3.new(1.2 * radius * glowScale1, 9000, 1.2 * radius * glowScale1)
  1831. beamGlowMesh1.VertexColor = vertexColor
  1832. beamGlowMesh2.Scale = Vector3.new(1.2 * radius * glowScale2, 9000, 1.2 * radius * glowScale2)
  1833. beamGlowMesh2.VertexColor = vertexColor
  1834. RunService.Stepped:wait()
  1835. gameTime = TaskScheduler.GetCurrentTime()
  1836. if frame <= 2 then
  1837. local explosion = Instance.new("Explosion")
  1838. explosion.BlastPressure = (1 - progress) * blastPressure
  1839. explosion.BlastRadius = (1 - progress) * power
  1840. explosion.Position = target
  1841. explosion.Parent = Workspace
  1842. if frame == 2 then
  1843. sound:Play()
  1844. end
  1845. end
  1846. end
  1847. pcall(beamPart.Destroy, beamPart)
  1848. explosionHitConnection:disconnect()
  1849. end
  1850. function GraphicalEffects.SpaceHyperBeam(target, power, duration, radius, height, deviation)
  1851. TaskScheduler.Start(GraphicalEffects.FireSpaceHyperBeam, target, power or 12, duration or 1.5, radius or 6, height or 600, deviation or 20)
  1852. end
  1853.  
  1854. function GraphicalEffects.CrystalRing(data)
  1855. data = data or {}
  1856. local crystal_count = data.crystal_count or 10
  1857. local crystal_color = data.crystal_color or BrickColor.new("Bright red")
  1858. local crystal_scale = data.crystal_scale or Vector3.new(2 / 3, 2, 2 / 3)
  1859. local fade_out_color = data.fade_out_color or BrickColor.new("Really black")
  1860. local radius = radius or 1.25 * crystal_count / math.pi
  1861. local spawn_duration = data.spawn_duration or 0.065
  1862. local full_spawn_duration = spawn_duration * crystal_count
  1863. local float_duration = data.float_duration or 5
  1864. local wave_amplitude = data.wave_amplitude or 0.5
  1865. local wave_period = data.wave_period or 1
  1866. local appear_duration = data.appear_duration or 0.1
  1867. local disappear_duration = data.disappear_duration or 0.5
  1868. local base_part = data.base_part
  1869. local offset_cframe
  1870. if data.position then
  1871. offset_cframe = CFrame.new(data.position)
  1872. if base_part then
  1873. offset_cframe = base_part.CFrame:toObjectSpace(offset_cframe)
  1874. end
  1875. else
  1876. offset_cframe = CFrame.new()
  1877. end
  1878. local crystal_template = Instance.new("Part")
  1879. crystal_template.Anchored = true
  1880. crystal_template.Locked = true
  1881. crystal_template.CanCollide = false
  1882. crystal_template.BottomSurface = "Smooth"
  1883. crystal_template.TopSurface = "Smooth"
  1884. crystal_template.BrickColor = crystal_color
  1885. crystal_template.FormFactor = "Symmetric"
  1886. crystal_template.Size = Vector3.new(1, 1, 1)
  1887. local crystal_light = Instance.new("PointLight", crystal_template)
  1888. crystal_light.Brightness = 0.1 / crystal_count
  1889. crystal_light.Color = crystal_color.Color
  1890. crystal_light.Name = "Light"
  1891. crystal_light.Range = radius
  1892. crystal_light.Shadows = true
  1893. local crystal_mesh = Instance.new("SpecialMesh", crystal_template)
  1894. crystal_mesh.MeshId = "rbxassetid://9756362"
  1895. crystal_mesh.MeshType = "FileMesh"
  1896. crystal_mesh.Name = "Mesh"
  1897. crystal_mesh.Scale = crystal_scale
  1898. local crystal_model = Instance.new("Model")
  1899. crystal_model.Archivable = false
  1900. crystal_model.Name = "Crystal Model"
  1901. crystal_model.Parent = Workspace
  1902. local crystals = {}
  1903. local lights = {}
  1904. local meshes = {}
  1905. for index = 1, crystal_count do
  1906. local crystal = crystal_template:Clone()
  1907. crystal.Parent = crystal_model
  1908. crystals[index] = crystal
  1909. lights[index] = crystal.Light
  1910. meshes[index] = crystal.Mesh
  1911. end
  1912. local start_time = tick()
  1913. repeat
  1914. local base_cframe = offset_cframe
  1915. if base_part then
  1916. base_cframe = base_part.CFrame * base_cframe
  1917. end
  1918. local elapsed_time = tick() - start_time
  1919. for index, crystal in ipairs(crystals) do
  1920. local crystal_time = elapsed_time - index * spawn_duration
  1921. local disappear_time = crystal_time - float_duration
  1922. local offset
  1923. if crystal_time < 0 then
  1924. offset = 0
  1925. elseif crystal_time < appear_duration then
  1926. offset = radius * crystal_time / appear_duration
  1927. else
  1928. offset = radius
  1929. end
  1930. local wave_offset
  1931. if disappear_time >= 0 then
  1932. local disappear_progress = disappear_time / disappear_duration
  1933. if disappear_progress > 1 then
  1934. if crystal.Parent then
  1935. crystal:Destroy()
  1936. end
  1937. else
  1938. local inverse_progress = 1 - disappear_progress
  1939. local light = lights[index]
  1940. local mesh = meshes[index]
  1941. crystal.BrickColor = fade_out_color
  1942. light.Brightness = 2 * inverse_progress
  1943. light.Range = 2 * radius
  1944. mesh.Scale = crystal_scale * inverse_progress
  1945. end
  1946. wave_offset = 0
  1947. else
  1948. wave_offset = wave_amplitude * math.sin(math.tau * (elapsed_time - index / crystal_count * 3) / wave_period)
  1949. end
  1950. local rotation_angle = (tick() * 0.5 + (index - 1) / crystal_count) % 1 * math.tau
  1951. crystal.CFrame = base_cframe * CFrame.Angles(0, rotation_angle, 0) * CFrame.new(0, wave_offset, -offset)
  1952. end
  1953. RunService.Stepped:wait()
  1954. until elapsed_time >= float_duration + full_spawn_duration + disappear_duration
  1955. if crystal_model.Parent then
  1956. crystal_model:Destroy()
  1957. end
  1958. end
  1959.  
  1960. GraphicalEffects.magicCircleData = {}
  1961. GraphicalEffects.MAGIC_CIRCLE_DEFAULT_OFFSET = 6.25
  1962. function GraphicalEffects.AnimateMagicCircle(data)
  1963. local frame, direction, magic_circle_model, magic_circle_part, magic_circle_light, magic_circle_decal_back, magic_circle_decal_front, duration,
  1964.  
  1965. stay, magic_circle_adornee_func, magic_circle_offset = unpack(data)
  1966. frame = frame + 1
  1967. data[1] = frame
  1968. local transparency = (frame / duration) ^ stay
  1969. local opacity = 1 - transparency
  1970. if frame == duration then
  1971. pcall(Game.Destroy, magic_circle_model)
  1972. GraphicalEffects.magicCircleData[data] = nil
  1973. else
  1974. if magic_circle_model.Parent ~= Workspace then
  1975. pcall(Utility.SetProperty, magic_circle_model, "Parent", Workspace)
  1976. end
  1977. local magic_circle_adornee = magic_circle_adornee_func()
  1978. magic_circle_position = magic_circle_adornee.Position + direction * magic_circle_offset
  1979. local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, math.tau * frame /
  1980.  
  1981. 25)
  1982. magic_circle_part.CFrame = magic_circle_cframe
  1983. magic_circle_light.Brightness = opacity
  1984. magic_circle_decal_back.Transparency = transparency
  1985. magic_circle_decal_front.Transparency = transparency
  1986. end
  1987. end
  1988. function GraphicalEffects.CreateMagicCircle(target, magic_circle_scale, magic_circle_image, light_color, duration, stay, magic_circle_adornee_func,
  1989.  
  1990. magic_circle_offset)
  1991. local magic_circle_adornee = magic_circle_adornee_func()
  1992. if magic_circle_adornee then
  1993. local origin = magic_circle_adornee.Position
  1994. local direction = (target - origin).unit
  1995. local magic_circle_position = origin + direction * magic_circle_offset
  1996. local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction)
  1997. local magic_circle_model = Instance.new("Model")
  1998. local magic_circle_part = Instance.new("Part", magic_circle_model)
  1999. local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part)
  2000. local magic_circle_light = Instance.new("PointLight", magic_circle_part)
  2001. local magic_circle_decal_back = Instance.new("Decal", magic_circle_part)
  2002. local magic_circle_decal_front = Instance.new("Decal", magic_circle_part)
  2003. magic_circle_model.Archivable = false
  2004. magic_circle_part.Anchored = true
  2005. magic_circle_part.BottomSurface = "Smooth"
  2006. magic_circle_part.CanCollide = false
  2007. magic_circle_part.CFrame = magic_circle_cframe
  2008. magic_circle_part.FormFactor = "Custom"
  2009. magic_circle_part.Locked = true
  2010. magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2)
  2011. magic_circle_part.TopSurface = "Smooth"
  2012. magic_circle_part.Transparency = 1
  2013. magic_circle_mesh.Scale = Vector3.new(60, 60, 0) * magic_circle_scale
  2014. magic_circle_light.Color = light_color
  2015. magic_circle_light.Range = 16 * magic_circle_scale
  2016. magic_circle_light.Shadows = true
  2017. magic_circle_decal_back.Face = "Back"
  2018. magic_circle_decal_back.Texture = magic_circle_image
  2019. magic_circle_decal_front.Face = "Front"
  2020. magic_circle_decal_front.Texture = magic_circle_image
  2021. magic_circle_model.Parent = Workspace
  2022. local data = {0, direction, magic_circle_model, magic_circle_part, magic_circle_light, magic_circle_decal_back, magic_circle_decal_front,
  2023.  
  2024. duration, stay, magic_circle_adornee_func, magic_circle_offset}
  2025. GraphicalEffects.magicCircleData[data] = true
  2026. return data
  2027. end
  2028. end
  2029.  
  2030. GraphicalEffects.missileData = {}
  2031. GraphicalEffects.missileParts = {}
  2032. function GraphicalEffects.AnimateMissile(data)
  2033. local frame, missilePart, targetPart, timeCreated, direction, touchedConnection, explodeRequested, bodyGyro, swooshSound, magicCircleData, lifeTime,
  2034.  
  2035. pointOnPart, flipped = unpack(data)
  2036. frame = frame + 1
  2037. data[1] = frame
  2038. if flipped then
  2039. direction = -direction
  2040. end
  2041. if frame <= 10 then
  2042. if frame == 2 then
  2043. swooshSound:Play()
  2044. end
  2045. missilePart.Anchored = true
  2046. local progress = frame / 10
  2047. missilePart.Size = Vector3.new(1, 1, progress * 4)
  2048. local magicCirclePart = magicCircleData[4]
  2049. local magicCirclePosition = magicCirclePart.Position
  2050. local missileOffset = 2 * progress * direction
  2051. local missilePosition = magicCirclePosition + missileOffset
  2052. missilePart.CFrame = CFrame.new(missilePosition, missilePosition + direction)
  2053. --missilePart.Transparency = 0.5 * (1 - progress)
  2054. if frame == 10 then
  2055. touchedConnection = missilePart.Touched:connect(function(hit)
  2056. if hit.CanCollide and hit.Parent and not GraphicalEffects.missileParts[hit] then
  2057. touchedConnection:disconnect()
  2058. data[7] = true
  2059. end
  2060. end)
  2061. data[6] = touchedConnection
  2062. end
  2063. else
  2064. missilePart.Anchored = false
  2065. local missilePosition = missilePart.Position
  2066. local targetPosition = targetPart.CFrame * pointOnPart
  2067. local distanceVector = targetPosition - missilePosition
  2068. local elapsedTime = time() - timeCreated
  2069. local targetParent = targetPart.Parent
  2070. if explodeRequested or (targetParent and distanceVector.magnitude < 10) or elapsedTime > lifeTime then
  2071. GraphicalEffects.missileData[data] = nil
  2072. GraphicalEffects.missileParts[missilePart] = nil
  2073. touchedConnection:disconnect()
  2074. if missilePart.Parent then
  2075. missilePart:Destroy()
  2076. local explosion = Instance.new("Explosion")
  2077. explosion.BlastRadius = 12.5
  2078. explosion.Position = missilePosition
  2079. local explosionHitConnection = explosion.Hit:connect(function(hit, distance)
  2080. local missileData = GraphicalEffects.missileParts[hit]
  2081. if missileData and distance < 3 then
  2082. missileData[7] = true
  2083. else
  2084. pcall(hit.BreakJoints, hit)
  2085. end
  2086. end)
  2087. explosion.Parent = Workspace
  2088. TaskScheduler.Schedule(1, explosionHitConnection.disconnect, explosionHitConnection)
  2089. end
  2090. else
  2091. local targetInWorkspace = targetPart:IsDescendantOf(Workspace)
  2092. if targetInWorkspace then
  2093. direction = distanceVector.unit
  2094. data[5] = direction
  2095. end
  2096. local speed = 14 + elapsedTime * 10
  2097. local gyroD
  2098. if elapsedTime < 42.5 and targetInWorkspace then
  2099. gyroD = 1000 - elapsedTime * 15
  2100. else
  2101. gyroD = 100
  2102. bodyGyro.maxTorque = Vector3.new(0, 0, 0)
  2103. if elapsedTime + 7.5 < lifeTime then
  2104. data[11] = elapsedTime + 7.5
  2105. end
  2106. end
  2107. bodyGyro.D = gyroD
  2108. bodyGyro.cframe = CFrame.new(Vector3.new(), direction)
  2109. missilePart.Velocity = missilePart.CFrame.lookVector * speed
  2110. end
  2111. end
  2112. end
  2113. function GraphicalEffects.ShootMissile(targetPart, pointOnPart, direction, magic_circle_adornee_func, magic_circle_offset, flipped)
  2114. if not magic_circle_offset then
  2115. magic_circle_offset = GraphicalEffects.MAGIC_CIRCLE_DEFAULT_OFFSET
  2116. end
  2117. local targetPosition = targetPart.Position
  2118. local headPosition = chatAdornee.Position
  2119. local origin = CFrame.new(headPosition, headPosition + direction) + direction * magic_circle_offset
  2120. local missilePart = Instance.new("Part")
  2121. local antiGravityForce = Instance.new("BodyForce", missilePart)
  2122. local bodyGyro = Instance.new("BodyGyro", missilePart)
  2123. local explosionSound = Instance.new("Sound", missilePart)
  2124. local swooshSound = Instance.new("Sound", missilePart)
  2125. antiGravityForce.force = Vector3.new(0, 196.2 * 4, 0)
  2126. bodyGyro.D = 1000
  2127. bodyGyro.maxTorque = Vector3.new(1, 1, 1)
  2128. explosionSound.PlayOnRemove = true
  2129. explosionSound.SoundId = "rbxasset://sounds/collide.wav"
  2130. explosionSound.Volume = 1
  2131. missilePart.Anchored = true
  2132. missilePart.BackSurface = "Studs"
  2133. missilePart.BottomSurface = "Studs"
  2134. missilePart.BrickColor = BrickColor.Red()
  2135. missilePart.CFrame = origin
  2136. missilePart.FormFactor = "Custom"
  2137. missilePart.FrontSurface = "Studs"
  2138. missilePart.LeftSurface = "Studs"
  2139. missilePart.Locked = true
  2140. missilePart.RightSurface = "Studs"
  2141. missilePart.Size = Vector3.new(1, 1, 0.2)
  2142. missilePart.TopSurface = "Studs"
  2143. --missilePart.Transparency = 0.5
  2144. swooshSound.Looped = true
  2145. swooshSound.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav"
  2146. swooshSound.Volume = 0.7
  2147. local magicCircleData = GraphicalEffects.CreateMagicCircle(headPosition + direction * 1000, 0.875, "rbxassetid://127033719", Color3.new(1, 1, 1),
  2148.  
  2149. 40, 4, magic_circle_adornee_func or function() return chatAdornee end, magic_circle_offset)
  2150. local data = {0, missilePart, targetPart, time(), direction, false, false, bodyGyro, swooshSound, magicCircleData, 50, pointOnPart, flipped}
  2151. missilePart.Parent = Workspace
  2152. GraphicalEffects.missileData[data] = true
  2153. GraphicalEffects.missileParts[missilePart] = data
  2154. end
  2155.  
  2156. function GraphicalEffects.CubicInterpolate(y0, y1, y2, y3, mu)
  2157. local a0, a1, a2, a3, mu2
  2158. mu2 = mu * mu
  2159. a0 = y3 - y2 - y0 + y1
  2160. a1 = y0 - y1 - a0
  2161. a2 = y2 - y0
  2162. a3 = y1
  2163. return a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3
  2164. end
  2165. function GraphicalEffects.JointCrap(model, cycletime)
  2166. if model then
  2167. local cycletime = cycletime or (0.75 * (1 + math.random() * 4))
  2168. local offsetradius = 0.75
  2169. local rotationoffset = math.pi
  2170. local joints = {}
  2171. local stack = model:GetChildren()
  2172. while #stack ~= 0 do
  2173. local object = stack[#stack]
  2174. table.remove(stack)
  2175. for index, child in ipairs(object:GetChildren()) do
  2176. table.insert(stack, child)
  2177. end
  2178. if object:IsA("JointInstance") then
  2179. table.insert(joints, object)
  2180. end
  2181. end
  2182. local rot0 = {}
  2183. local rot1 = {}
  2184. local rot2 = {}
  2185. local rot3 = {}
  2186. local rot4 = {}
  2187. for index, joint in ipairs(joints) do
  2188. local pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius
  2189. local rot = Vector3.new(math.random(), math.random(), math.random()) * rotationoffset
  2190. rot0[index] = {joint.C0, joint.C1}
  2191. rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau))
  2192. rot2[index] = {pos, rot}
  2193. pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius
  2194. rot = rot + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset
  2195. rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau))
  2196. rot3[index] = {pos, rot}
  2197. pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius
  2198. rot = rot + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset
  2199. rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau))
  2200. rot4[index] = {pos, rot}
  2201. end
  2202. while model.Parent do
  2203. for i, j in ipairs(joints) do
  2204. local pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius
  2205. local rot = rot4[i][2] + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset
  2206. rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau))
  2207. rot1[i], rot2[i], rot3[i], rot4[i] = rot2[i], rot3[i], rot4[i], {pos, rot}
  2208. end
  2209. local start = tick()
  2210. while true do
  2211. local ctime = tick()
  2212. local elapsed = ctime - start
  2213. if elapsed > cycletime then
  2214. break
  2215. end
  2216. local progress = elapsed / cycletime
  2217. for index, joint in ipairs(joints) do
  2218. local v0, v1, v2, v3, v4 = rot0[index], rot1[index], rot2[index], rot3[index], rot4[index]
  2219. 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]
  2220. local px = GraphicalEffects.CubicInterpolate(p1.x, p2.x, p3.x, p4.x, progress)
  2221. local py = GraphicalEffects.CubicInterpolate(p1.y, p2.y, p3.y, p4.y, progress)
  2222. local pz = GraphicalEffects.CubicInterpolate(p1.z, p2.z, p3.z, p4.z, progress)
  2223. local rx = GraphicalEffects.CubicInterpolate(r1.x, r2.x, r3.x, r4.x, progress)
  2224. local ry = GraphicalEffects.CubicInterpolate(r1.y, r2.y, r3.y, r4.y, progress)
  2225. local rz = GraphicalEffects.CubicInterpolate(r1.z, r2.z, r3.z, r4.z, progress)
  2226. local cframe = CFrame.new(px, py, pz) * CFrame.Angles(rx, ry, rz)
  2227. joint.C0 = v0[1] * cframe
  2228. joint.C1 = v0[2] * cframe:inverse()
  2229. end
  2230. RunService.Stepped:wait()
  2231. end
  2232. end
  2233. end
  2234. end
  2235.  
  2236. GraphicalEffects.LASER_WIDTH = 0.15
  2237. GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE = 6.25
  2238. GraphicalEffects.laser_data = {}
  2239. --GraphicalEffects.fragmentation = {}
  2240. function GraphicalEffects.AnimateLaserOfDeath(data)
  2241. local frame, directionOrientation, direction, magic_circle_model, laser_part, laser_mesh, magic_circle_part, magic_circle_light,
  2242.  
  2243. magic_circle_decal_back, magic_circle_decal_front, sound, laser_scale, fragmentation_size, duration, laser_lights, laser_effects, stay, light_effects =
  2244.  
  2245. unpack(data)
  2246. local laser_color = laser_part.Color
  2247. frame = frame + 1
  2248. data[1] = frame
  2249. local transparency = (frame / duration) ^ stay
  2250. local opacity = 1 - transparency
  2251. if frame == 2 then
  2252. sound:Play()
  2253. end
  2254. if frame == duration then
  2255. pcall(Game.Destroy, magic_circle_model)
  2256. GraphicalEffects.laser_data[data] = nil
  2257. else
  2258. if magic_circle_model.Parent ~= Workspace then
  2259. pcall(Utility.SetProperty, magic_circle_model, "Parent", Workspace)
  2260. end
  2261. local laser_distance = 0
  2262. local origin = chatAdornee.CFrame
  2263. if not light_effects then
  2264. direction = (origin * directionOrientation - origin.p).unit
  2265. end
  2266. local magic_circle_position = origin.p + direction * GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE
  2267. local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, math.tau * frame /
  2268.  
  2269. 25)
  2270. local loop_scale = (laser_scale - 1) / 10
  2271. for x_offset = -loop_scale, loop_scale, 2 do
  2272. for y_offset = -loop_scale, loop_scale, 2 do
  2273. local origin_position = magic_circle_cframe * Vector3.new(x_offset, y_offset, 0)
  2274. for index = 1, 8 do
  2275. local part, position
  2276. for ray_index = 1, 10 do
  2277. local ray = Ray.new(origin_position + direction * (999 * (ray_index - 1)), direction * 999)
  2278. part, position = Workspace:FindPartOnRay(ray, magic_circle_model)
  2279. if part then
  2280. break
  2281. end
  2282. end
  2283. if part then
  2284. laser_distance = (position - origin_position).magnitude
  2285. if frame % 8 == 1 and index == 1 then
  2286. Instance.new("Explosion", Workspace).Position = position
  2287. end
  2288. if not part:IsA("Terrain") then
  2289. pcall(part.BreakJoints, part)
  2290. local is_block = part:IsA("Part") and part.Shape == Enum.PartType.Block
  2291. local mass = part:GetMass()
  2292. local size = part.Size
  2293. if (is_block and ((size.X < fragmentation_size and size.Y < fragmentation_size and size.Z <
  2294.  
  2295. fragmentation_size) or (not part.Anchored and mass < 750))) or (not is_block and mass < 250000) then
  2296. local part_transparency = math.max(part.Transparency + 0.007 * fragmentation_size, 0.5)
  2297. if part_transparency >= 0.5 then -- temporarily to minimize debris
  2298. pcall(Game.Destroy, part)
  2299. else
  2300. local cframe = part.CFrame
  2301. part.Anchored = false
  2302. part.BrickColor = BrickColor.new("Medium stone grey")
  2303. part.CanCollide = true
  2304. if part:IsA("FormFactorPart") then
  2305. part.FormFactor = "Custom"
  2306. end
  2307. part.Size = size - Vector3.new(0.135, 0.135, 0.135) * fragmentation_size
  2308. part.Transparency = part_transparency
  2309. part.CFrame = cframe + direction * 5
  2310. part.Velocity = part.Velocity + direction * 40
  2311. end
  2312. elseif is_block then
  2313. local parts = {part}
  2314. local model = Instance.new("Model", part.Parent)
  2315. model.Name = "Fragments"
  2316. if size.X >= fragmentation_size then
  2317. size = Vector3.new(0.5, 1, 1) * size
  2318. local archivable = part.Archivable
  2319. local cframe = part.CFrame
  2320. part.FormFactor = "Custom"
  2321. part.Size = size
  2322. part.Archivable = true
  2323. local part_clone = part:Clone()
  2324. part.Archivable = archivable
  2325. part_clone.Archivable = archivable
  2326. part.CFrame = cframe * CFrame.new(-0.5 * size.X, 0, 0)
  2327. part_clone.CFrame = cframe * CFrame.new(0.5 * size.X, 0, 0)
  2328. part_clone.Parent = model
  2329. parts[2] = part_clone
  2330. end
  2331. if size.Y >= fragmentation_size then
  2332. size = Vector3.new(1, 0.5, 1) * size
  2333. for part_index = 1, #parts do
  2334. local part = parts[part_index]
  2335. local archivable = part.Archivable
  2336. local cframe = part.CFrame
  2337. part.FormFactor = "Custom"
  2338. part.Size = size
  2339. part.Archivable = true
  2340. local part_clone = part:Clone()
  2341. part.Archivable = archivable
  2342. part_clone.Archivable = archivable
  2343. part.CFrame = cframe * CFrame.new(0, -0.5 * size.Y, 0)
  2344. part_clone.CFrame = cframe * CFrame.new(0, 0.5 * size.Y, 0)
  2345. part_clone.Parent = model
  2346. table.insert(parts, part_clone)
  2347. end
  2348. end
  2349. if size.Z >= fragmentation_size then
  2350. size = Vector3.new(1, 1, 0.5) * size
  2351. for part_index = 1, #parts do
  2352. local part = parts[part_index]
  2353. local archivable = part.Archivable
  2354. local cframe = part.CFrame
  2355. part.FormFactor = "Custom"
  2356. part.Size = size
  2357. part.Archivable = true
  2358. local part_clone = part:Clone()
  2359. part.Archivable = archivable
  2360. part_clone.Archivable = archivable
  2361. part.CFrame = cframe * CFrame.new(0, 0, -0.5 * size.Z)
  2362. part_clone.CFrame = cframe * CFrame.new(0, 0, 0.5 * size.Z)
  2363. part_clone.Parent = model
  2364. table.insert(parts, part_clone)
  2365. end
  2366. end
  2367. for _, part in ipairs(parts) do
  2368. part:MakeJoints()
  2369. end
  2370. else
  2371. break
  2372. end
  2373. end
  2374. else
  2375. laser_distance = 9990
  2376. break
  2377. end
  2378. end
  2379. end
  2380. end
  2381. local laser_cframe = magic_circle_cframe * CFrame.Angles(-0.5 * math.pi, 0, 0)
  2382. local laser_width = GraphicalEffects.LASER_WIDTH * opacity * laser_scale
  2383. local laser_mesh_offset = Vector3.new(0, 0.5 * laser_distance, 0)
  2384. laser_part.CFrame = laser_cframe
  2385. if laser_effects then
  2386. local laser_effect_data_1, laser_effect_data_2 = laser_effects[1], laser_effects[2]
  2387. local laser_effect_1, laser_effect_mesh_1 = laser_effect_data_1[1], laser_effect_data_1[2]
  2388. local laser_effect_2, laser_effect_mesh_2 = laser_effect_data_2[1], laser_effect_data_2[2]
  2389. laser_effect_1.CFrame = laser_cframe
  2390. laser_effect_2.CFrame = laser_cframe
  2391. laser_effect_mesh_1.Offset = laser_mesh_offset
  2392. laser_effect_mesh_2.Offset = laser_mesh_offset
  2393. local game_time = time()
  2394. local effect_scale_1 = 0.5 + 0.5 * math.sin(16 * math.pi * game_time)
  2395. local effect_scale_2 = 0.5 + 0.5 * math.cos(16 * math.pi * game_time)
  2396. laser_effect_mesh_1.Scale = 5 * Vector3.new(laser_width * effect_scale_1, laser_distance, laser_width * effect_scale_1)
  2397. laser_effect_mesh_2.Scale = 5 * Vector3.new(laser_width * effect_scale_2, laser_distance, laser_width * effect_scale_2)
  2398. laser_width = laser_width * 0.25
  2399. end
  2400. laser_mesh.Offset = laser_mesh_offset
  2401. laser_mesh.Scale = 5 * Vector3.new(laser_width, laser_distance, laser_width)
  2402. magic_circle_part.CFrame = magic_circle_cframe
  2403. magic_circle_light.Brightness = opacity
  2404. magic_circle_decal_back.Transparency = transparency
  2405. magic_circle_decal_front.Transparency = transparency
  2406. if light_effects then
  2407. for index, data in ipairs(laser_lights) do
  2408. local laser_spotlight_part, laser_spotlight = data[1], data[2]
  2409. local laser_spotlight_offset = 30 * (index - 1)
  2410. if laser_spotlight_offset <= laser_distance then
  2411. laser_spotlight_part.CFrame = magic_circle_cframe * CFrame.new(0, 0, -laser_spotlight_offset)
  2412. laser_spotlight.Brightness = opacity
  2413. laser_spotlight.Enabled = true
  2414. else
  2415. laser_spotlight.Enabled = false
  2416. end
  2417. end
  2418. end
  2419. end
  2420. end
  2421. function GraphicalEffects.ShootLaserOfDeath(target, data)
  2422. if chatAdornee then
  2423. data = data or {}
  2424. local brickcolor = data.brickcolor or BrickColor.new("Really black")
  2425. local duration = data.duration or 40
  2426. local fragmentation_size = data.fragmentation_size or 3
  2427. local laser_scale = data.laser_scale or 1
  2428. local light_color = data.light_color or Color3.new(1, 0.5, 1)
  2429. local magic_circle_image = data.magic_circle_image or "rbxassetid://122610943"
  2430. local magic_circle_scale = data.magic_circle_scale or 1
  2431. local sound_volume = data.sound_volume or 1 / 3
  2432. local special_effects = data.special_effects
  2433. local stay = data.stay or 4
  2434. local origin = chatAdornee.CFrame
  2435. local directionOrientation = origin:pointToObjectSpace(target)
  2436. local direction = (target - origin.p).unit
  2437. local magic_circle_position = origin.p + direction * GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE
  2438. local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction)
  2439. local magic_circle_model = Instance.new("Model")
  2440. local laser_part = Instance.new("Part", magic_circle_model)
  2441. local laser_mesh = Instance.new("CylinderMesh", laser_part)
  2442. local magic_circle_part = Instance.new("Part", magic_circle_model)
  2443. local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part)
  2444. local magic_circle_light = Instance.new("PointLight", magic_circle_part)
  2445. local magic_circle_decal_back = Instance.new("Decal", magic_circle_part)
  2446. local magic_circle_decal_front = Instance.new("Decal", magic_circle_part)
  2447. local sound = Instance.new("Sound", magic_circle_part)
  2448. sound.Pitch = 1.25
  2449. sound.SoundId = "rbxassetid://2248511"
  2450. sound.Volume = sound_volume
  2451. magic_circle_model.Archivable = false
  2452. laser_part.Anchored = true
  2453. laser_part.BottomSurface = "Smooth"
  2454. laser_part.BrickColor = brickcolor
  2455. laser_part.CanCollide = false
  2456. laser_part.CFrame = magic_circle_cframe * CFrame.Angles(-0.5 * math.pi, 0, 0)
  2457. laser_part.FormFactor = "Custom"
  2458. laser_part.Locked = true
  2459. laser_part.Size = Vector3.new(0.2, 0.2, 0.2)
  2460. laser_part.TopSurface = "Smooth"
  2461. laser_mesh.Offset = Vector3.new(0, 0, 0)
  2462. laser_mesh.Name = "Mesh"
  2463. laser_mesh.Scale = 5 * laser_scale * Vector3.new(GraphicalEffects.LASER_WIDTH, 0, GraphicalEffects.LASER_WIDTH)
  2464. magic_circle_part.Anchored = true
  2465. magic_circle_part.BottomSurface = "Smooth"
  2466. magic_circle_part.CanCollide = false
  2467. magic_circle_part.CFrame = magic_circle_cframe
  2468. magic_circle_part.FormFactor = "Custom"
  2469. magic_circle_part.Locked = true
  2470. magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2)
  2471. magic_circle_part.TopSurface = "Smooth"
  2472. magic_circle_part.Transparency = 1
  2473. magic_circle_mesh.Scale = Vector3.new(60, 60, 0) * magic_circle_scale
  2474. magic_circle_light.Color = light_color
  2475. magic_circle_light.Range = 16 * magic_circle_scale
  2476. magic_circle_light.Shadows = true
  2477. magic_circle_decal_back.Face = "Back"
  2478. magic_circle_decal_back.Texture = magic_circle_image
  2479. magic_circle_decal_front.Face = "Front"
  2480. magic_circle_decal_front.Texture = magic_circle_image
  2481. magic_circle_model.Parent = Workspace
  2482. local laser_color = brickcolor.Color
  2483. local laser_lights = {}
  2484. local light_effects = laser_color.r + laser_color.g + laser_color.b > 0.25
  2485. if light_effects then
  2486. local laser_spotlight_part_template = Instance.new("Part")
  2487. local laser_spotlight_light_template = Instance.new("SpotLight", laser_spotlight_part_template)
  2488. laser_spotlight_part_template.Anchored = true
  2489. laser_spotlight_part_template.Anchored = true
  2490. laser_spotlight_part_template.BottomSurface = "Smooth"
  2491. laser_spotlight_part_template.CanCollide = false
  2492. laser_spotlight_part_template.FormFactor = "Custom"
  2493. laser_spotlight_part_template.Locked = true
  2494. laser_spotlight_part_template.Size = Vector3.new(0.2, 0.2, 0.2)
  2495. laser_spotlight_part_template.TopSurface = "Smooth"
  2496. laser_spotlight_part_template.Transparency = 1
  2497. laser_spotlight_light_template.Angle = 45
  2498. laser_spotlight_light_template.Color = laser_color
  2499. laser_spotlight_light_template.Enabled = true
  2500. laser_spotlight_light_template.Name = "Light"
  2501. laser_spotlight_light_template.Range = 60
  2502. for index = 1, 40 do
  2503. local laser_spotlight_part = laser_spotlight_part_template:Clone()
  2504. laser_spotlight_part.CFrame = magic_circle_cframe * CFrame.new(0, 0, -30 * (index - 1))
  2505. laser_spotlight_part.Parent = magic_circle_model
  2506. laser_lights[index] = {laser_spotlight_part, laser_spotlight_part.Light}
  2507. end
  2508. end
  2509. local laser_effects
  2510. if special_effects then
  2511. laser_effects = {}
  2512. local laser_effect_1 = laser_part:Clone()
  2513. laser_effect_1.BrickColor = special_effects
  2514. laser_effect_1.Transparency = 0.5
  2515. local laser_effect_2 = laser_effect_1:Clone()
  2516. laser_effects[1], laser_effects[2] = {laser_effect_1, laser_effect_1.Mesh}, {laser_effect_2, laser_effect_2.Mesh}
  2517. laser_effect_1.Parent = magic_circle_model
  2518. laser_effect_2.Parent = magic_circle_model
  2519. end
  2520. GraphicalEffects.laser_data[{0, directionOrientation, direction, magic_circle_model, laser_part, laser_mesh, magic_circle_part,
  2521.  
  2522. magic_circle_light, magic_circle_decal_back, magic_circle_decal_front, sound, laser_scale, fragmentation_size, duration, laser_lights, laser_effects, stay,
  2523.  
  2524. light_effects}] = true
  2525. end
  2526. end
  2527.  
  2528. function GraphicalEffects.SpawnSapientRock(position)
  2529. local part = Instance.new("Part", Workspace)
  2530. local size = 8 + math.random(0, 5)
  2531. part.BottomSurface = "Smooth"
  2532. part.TopSurface = "Smooth"
  2533. part.Material = "Slate"
  2534. part.Locked = true
  2535. part.Shape = "Ball"
  2536. part.FormFactor = "Custom"
  2537. part.Size = Vector3.new(size, size, size)
  2538. part.Position = position
  2539. local bodypos = Instance.new("BodyPosition", part)
  2540. bodypos.maxForce = Vector3.new(0, 0, 0)
  2541. local angry = false
  2542. local damage_ready = true
  2543. local torso_following
  2544. local torso_changed = -1000
  2545. local touched_conn = part.Touched:connect(function(hit)
  2546. local character = hit.Parent
  2547. if character then
  2548. local humanoid
  2549. for _, child in ipairs(character:GetChildren()) do
  2550. if child:IsA("Humanoid") then
  2551. humanoid = child
  2552. break
  2553. end
  2554. end
  2555. if humanoid then
  2556. if angry then
  2557. if damage_ready then
  2558. damage_ready = false
  2559. humanoid:TakeDamage(100)
  2560. wait(1)
  2561. damage_ready = true
  2562. angry = false
  2563. part.BrickColor = BrickColor.new("Medium stone grey")
  2564. end
  2565. else
  2566. local torso = humanoid.Torso
  2567. if torso then
  2568. torso_following = torso
  2569. torso_changed = tick()
  2570. end
  2571. end
  2572. end
  2573. end
  2574. end)
  2575. TaskScheduler.Start(function()
  2576. while part.Parent == Workspace do
  2577. if torso_following then
  2578. bodypos.position = torso_following.Position
  2579. if tick() - torso_changed > 60 or not torso_following.Parent then
  2580. torso_following = nil
  2581. bodypos.maxForce = Vector3.new(0, 0, 0)
  2582. angry = false
  2583. part.BrickColor = BrickColor.new("Medium stone grey")
  2584. else
  2585. local speed = angry and Vector3.new(16, 16, 16) or Vector3.new(6, 0, 6)
  2586. bodypos.maxForce = part:GetMass() * speed
  2587. if part.Position.Y < -250 then
  2588. part.Velocity = Vector3.new()
  2589. part.Position = torso_following.Position + Vector3.new(0, 80, 0)
  2590. part.BrickColor = BrickColor.new("Bright red")
  2591. angry = true
  2592. torso_changed = tick()
  2593. end
  2594. end
  2595. end
  2596. RunService.Stepped:wait()
  2597. end
  2598. touched_conn:disconnect()
  2599. end)
  2600. TaskScheduler.Start(function()
  2601. while part.Parent == Workspace do
  2602. wait(25 + math.random() * 10)
  2603. local next_size = 8 + math.random() * 5
  2604. if math.random(100) == 1 then
  2605. next_size = next_size * (2 + 6 * math.random())
  2606. end
  2607. next_size = math.floor(next_size + 0.5)
  2608. local start_time = tick()
  2609. local mesh = Instance.new("SpecialMesh", part)
  2610. mesh.MeshType = "Sphere"
  2611. repeat
  2612. local elapsed_time = tick() - start_time
  2613. local alpha = math.cos(elapsed_time * math.pi * 0.5)
  2614. local interpolated_size = size * alpha + next_size * (1 - alpha)
  2615. local size_vector = Vector3.new(interpolated_size, interpolated_size, interpolated_size)
  2616. local cframe = part.CFrame
  2617. part.Size = size_vector
  2618. part.CFrame = cframe
  2619. mesh.Scale = size_vector / part.Size
  2620. RunService.Stepped:wait()
  2621. until tick() - start_time >= 1
  2622. mesh:Destroy()
  2623. local cframe = part.CFrame
  2624. part.Size = Vector3.new(next_size, next_size, next_size)
  2625. part.CFrame = cframe
  2626. size = next_size
  2627. end
  2628. end)
  2629. end
  2630.  
  2631. function GraphicalEffects.MainLoop()
  2632. RunService.Stepped:wait()
  2633. for data in pairs(GraphicalEffects.magicCircleData) do
  2634. GraphicalEffects.AnimateMagicCircle(data)
  2635. end
  2636. for data in pairs(GraphicalEffects.laser_data) do
  2637. GraphicalEffects.AnimateLaserOfDeath(data)
  2638. end
  2639. for data in pairs(GraphicalEffects.missileData) do
  2640. GraphicalEffects.AnimateMissile(data)
  2641. end
  2642. end
  2643. TaskScheduler.Start(function()
  2644. while true do
  2645. GraphicalEffects.MainLoop()
  2646. end
  2647. end)
  2648.  
  2649. PlayerControl = {};
  2650.  
  2651. PlayerControl.fly_acceleration = 10
  2652. PlayerControl.fly_basespeed = 250
  2653. PlayerControl.fly_speed = PlayerControl.fly_basespeed
  2654. PlayerControl.featherfallEnabled = true
  2655. PlayerControl.pushable = false
  2656. PlayerControl.rolling = false
  2657. PlayerControl.rollingAngle = 0
  2658. PlayerControl.rollingOffset = 0
  2659. PlayerControl.rollingMaxOffset = 3
  2660. PlayerControl.rollingSpeed = 1 / 50
  2661. PlayerControl.characterEnabled = false
  2662. PlayerControl.characterMode = "normal"
  2663. local character = nil
  2664. local flying, flyingMomentum, flyingTilt = false, Vector3.new(), 0
  2665. local pose, regeneratingHealth, jumpDebounce = "Standing", false, false
  2666. -- TODO: make local variables public
  2667. local model, bodyColors, leftArmMesh, leftLegMesh, rightArmMesh, rightLegMesh, torsoMesh, wildcardHat, wildcardHandle, wildcardMesh, pants, shirt, humanoid,
  2668.  
  2669. head, leftArm, leftLeg, rightArm, rightLeg, torso, rootPart, rootJoint, face, soundFreeFalling, soundGettingUp, soundRunning, leftHip, leftShoulder,
  2670.  
  2671. rightHip, rightShoulder, neck, wildcardWeld, feetPart, feetWeld, feetTouchInterest, bodyGyro, bodyVelocity, headMesh, torsoLight
  2672. local AnimateCharacter
  2673. local UserInterface = game:service'UserInputService'
  2674. local chatBubbles = {}
  2675. local chatCharacterLimit = 240
  2676. function PlayerControl.CreateCharacter()
  2677. local characterMode = PlayerControl.characterMode
  2678. if characterMode == "normal" then
  2679. if not PlayerControl.characterEnabled then
  2680. return
  2681. end
  2682. local appearance = CharacterAppearance.GetDefaultAppearance()
  2683. local active = true
  2684. local torsoCFrame = (torso and torso.CFrame) or PlayerControl.torso_cframe or CFrame.new(0, 10, 0)
  2685. if torsoCFrame.p.Y < -450 then
  2686. torsoCFrame = CFrame.new(0, 10, 0)
  2687. end
  2688. local rootPartCFrame = (rootPart and rootPart.CFrame) or PlayerControl.torso_cframe or CFrame.new(0, 10, 0)
  2689. if rootPartCFrame.p.Y < -450 then
  2690. rootPartCFrame = CFrame.new(0, 10, 0)
  2691. end
  2692. local cameraCFrame = Camera.CoordinateFrame
  2693. local connections = {}
  2694. local feetTouching = {}
  2695. local previousWalkSpeed = 0
  2696. local prevLeftHip, prevLeftShoulder, prevRightHip, prevRightShoulder = leftHip, leftShoulder, rightHip, rightShoulder
  2697. model = Instance.new("Model")
  2698. humanoid = Instance.new("Humanoid", model)
  2699. head = Instance.new("Part", model)
  2700. leftArm = Instance.new("Part", model)
  2701. leftLeg = Instance.new("Part", model)
  2702. rightArm = Instance.new("Part", model)
  2703. rightLeg = Instance.new("Part", model)
  2704. torso = Instance.new("Part", model)
  2705. rootPart = Instance.new("Part", model)
  2706. soundFallingDown = Instance.new("Sound", head)
  2707. soundFreeFalling = Instance.new("Sound", head)
  2708. soundGettingUp = Instance.new("Sound", head)
  2709. soundJumping = Instance.new("Sound", head)
  2710. soundRunning = Instance.new("Sound", head)
  2711. leftHip = Instance.new("Motor", torso)
  2712. leftShoulder = Instance.new("Motor", torso)
  2713. rightHip = Instance.new("Motor", torso)
  2714. rightShoulder = Instance.new("Motor", torso)
  2715. neck = Instance.new("Motor", torso)
  2716. rootJoint = Instance.new("Motor", rootPart)
  2717. feetPart = Instance.new("Part", model)
  2718. feetWeld = Instance.new("Weld", torso)
  2719. bodyGyro = Instance.new("BodyGyro", rootPart)
  2720. bodyVelocity = Instance.new("BodyVelocity", rootPart)
  2721. model.Archivable = false
  2722. model.Name = user_name or Player.Name
  2723. model.PrimaryPart = head
  2724. humanoid.LeftLeg = leftLeg
  2725. humanoid.RightLeg = rightLeg
  2726. humanoid.Torso = rootPart
  2727. head.CFrame = torsoCFrame * CFrame.new(0, 1.5, 0)
  2728. head.FormFactor = "Symmetric"
  2729. head.Locked = true
  2730. head.Name = "Head"
  2731. head.Size = Vector3.new(2, 1, 1)
  2732. head.TopSurface = "Smooth"
  2733. leftArm.CanCollide = false
  2734. leftArm.CFrame = torsoCFrame * CFrame.new(-1.5, 0, 0)
  2735. leftArm.FormFactor = "Symmetric"
  2736. leftArm.Locked = true
  2737. leftArm.Name = "Left Arm"
  2738. leftArm.Size = Vector3.new(1, 2, 1)
  2739. leftLeg.BottomSurface = "Smooth"
  2740. leftLeg.CanCollide = false
  2741. leftLeg.CFrame = torsoCFrame * CFrame.new(-0.5, -2, 0)
  2742. leftLeg.FormFactor = "Symmetric"
  2743. leftLeg.Locked = true
  2744. leftLeg.Name = "Left Leg"
  2745. leftLeg.Size = Vector3.new(1, 2, 1)
  2746. leftLeg.TopSurface = "Smooth"
  2747. rightArm.CanCollide = false
  2748. rightArm.CFrame = torsoCFrame * CFrame.new(1.5, 0, 0)
  2749. rightArm.FormFactor = "Symmetric"
  2750. rightArm.Locked = true
  2751. rightArm.Name = "Right Arm"
  2752. rightArm.Size = Vector3.new(1, 2, 1)
  2753. rightLeg.BottomSurface = "Smooth"
  2754. rightLeg.CanCollide = false
  2755. rightLeg.CFrame = torsoCFrame * CFrame.new(0.5, -2, 0)
  2756. rightLeg.FormFactor = "Symmetric"
  2757. rightLeg.Locked = true
  2758. rightLeg.Name = "Right Leg"
  2759. rightLeg.Size = Vector3.new(1, 2, 1)
  2760. rightLeg.TopSurface = "Smooth"
  2761. torso.CFrame = torsoCFrame
  2762. torso.FormFactor = "Symmetric"
  2763. torso.LeftSurface = "Weld"
  2764. torso.Locked = true
  2765. torso.RightSurface = "Weld"
  2766. torso.Name = "Torso"
  2767. torso.Size = Vector3.new(2, 2, 1)
  2768. rootPart.BottomSurface = "Smooth"
  2769. rootPart.BrickColor = BrickColor.Blue()
  2770. rootPart.CFrame = rootPartCFrame
  2771. rootPart.FormFactor = "Symmetric"
  2772. rootPart.LeftSurface = "Weld"
  2773. rootPart.Locked = true
  2774. rootPart.RightSurface = "Weld"
  2775. rootPart.Name = "HumanoidRootPart"
  2776. rootPart.Size = Vector3.new(2, 2, 1)
  2777. rootPart.TopSurface = "Smooth"
  2778. rootPart.Transparency = 1
  2779. soundFreeFalling.Archivable = false
  2780. soundFreeFalling.SoundId = "rbxasset://sounds/swoosh.wav"
  2781. soundGettingUp.Archivable = false
  2782. soundGettingUp.SoundId = "rbxasset://sounds/hit.wav"
  2783. soundRunning.Archivable = false
  2784. soundRunning.SoundId = "rbxasset://sounds/bfsl-minifigfoots1.mp3"
  2785. soundRunning.Looped = true
  2786. leftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2787. leftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2788. leftHip.MaxVelocity = 0.1
  2789. leftHip.Name = "Left Hip"
  2790. leftHip.Part0 = torso
  2791. leftHip.Part1 = leftLeg
  2792. leftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2793. leftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2794. leftShoulder.MaxVelocity = 0.15
  2795. leftShoulder.Name = "Left Shoulder"
  2796. leftShoulder.Part0 = torso
  2797. leftShoulder.Part1 = leftArm
  2798. rightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2799. rightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2800. rightHip.MaxVelocity = 0.1
  2801. rightHip.Name = "Right Hip"
  2802. rightHip.Part0 = torso
  2803. rightHip.Part1 = rightLeg
  2804. rightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2805. rightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2806. rightShoulder.MaxVelocity = 0.15
  2807. rightShoulder.Name = "Right Shoulder"
  2808. rightShoulder.Part0 = torso
  2809. rightShoulder.Part1 = rightArm
  2810. if prevLeftHip then
  2811. leftHip.CurrentAngle = prevLeftHip.CurrentAngle
  2812. leftHip.DesiredAngle = prevLeftHip.DesiredAngle
  2813. end
  2814. if prevLeftShoulder then
  2815. leftShoulder.CurrentAngle = prevLeftShoulder.CurrentAngle
  2816. leftShoulder.DesiredAngle = prevLeftShoulder.DesiredAngle
  2817. end
  2818. if prevRightHip then
  2819. rightHip.CurrentAngle = prevRightHip.CurrentAngle
  2820. rightHip.DesiredAngle = prevRightHip.DesiredAngle
  2821. end
  2822. if prevRightShoulder then
  2823. rightShoulder.CurrentAngle = prevRightShoulder.CurrentAngle
  2824. rightShoulder.DesiredAngle = prevRightShoulder.DesiredAngle
  2825. end
  2826. neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  2827. neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  2828. neck.Name = "Neck"
  2829. neck.Part0 = torso
  2830. neck.Part1 = head
  2831. rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  2832. rootJoint.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  2833. rootJoint.Name = "RootJoint"
  2834. rootJoint.Part0 = rootPart
  2835. rootJoint.Part1 = torso
  2836. feetPart.BottomSurface = "Smooth"
  2837. feetPart.CanCollide = false
  2838. feetPart.CFrame = torsoCFrame * CFrame.new(0, -3.1, 0)
  2839. feetPart.FormFactor = "Custom"
  2840. feetPart.Locked = true
  2841. feetPart.Name = "Platform"
  2842. feetPart.Size = Vector3.new(1.8, 0.2, 0.8)
  2843. feetPart.TopSurface = "Smooth"
  2844. feetPart.Transparency = 1
  2845. feetWeld.C0 = CFrame.new(0, -3, 0)
  2846. feetWeld.C1 = CFrame.new(0, 0.1, 0)
  2847. feetWeld.Name = "PlatformWeld"
  2848. feetWeld.Part0 = torso
  2849. feetWeld.Part1 = feetPart
  2850. table.insert(connections, feetPart.Touched:connect(function(hit)
  2851. feetTouching[hit] = true
  2852. end))
  2853. table.insert(connections, feetPart.TouchEnded:connect(function(hit)
  2854. feetTouching[hit] = nil
  2855. end))
  2856. feetTouchInterest = feetPart:FindFirstChild("TouchInterest")
  2857. bodyGyro.D = 3250
  2858. bodyGyro.P = 400000
  2859. bodyGyro.maxTorque = Vector3.new(1000000000, 0, 1000000000)
  2860. bodyVelocity.P = 5000
  2861. bodyVelocity.maxForce = Vector3.new(0, 0, 0)
  2862. bodyVelocity.velocity = Vector3.new(0, 0, 0)
  2863. torsoLight = Instance.new("PointLight", torso)
  2864. torsoLight.Brightness = 0.4
  2865. torsoLight.Color = Color3.new(1, 1, 1)
  2866. torsoLight.Range = 16
  2867. torsoLight.Shadows = true
  2868. 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)
  2869. local forcefields = {[ff1] = head, [ff2] = leftArm, [ff3] = leftLeg, [ff4] = rightArm, [ff5] = rightLeg, [ff6] = torso, [ff7] = wildcardHandle, [ff8] = feetPart, [ff9] = rootPart}
  2870. 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}
  2871. local tshirtUrl = appearance.tshirt
  2872. if tshirtUrl then
  2873. local tshirt = Instance.new("Decal", torso)
  2874. tshirt.Name = "roblox"
  2875. tshirt.Texture = tshirtUrl
  2876. objects[tshirt] = true
  2877. end
  2878. for _, template in ipairs(appearance.characterObjects) do
  2879. local object = template:Clone()
  2880. local newObjects = {object}
  2881. for _, object in ipairs(newObjects) do
  2882. objects[object] = true
  2883. for _, child in ipairs(object:GetChildren()) do
  2884. table.insert(newObjects, child)
  2885. end
  2886. end
  2887. if object:IsA("BodyColors") then
  2888. head.BrickColor = object.HeadColor
  2889. leftArm.BrickColor = object.LeftArmColor
  2890. leftLeg.BrickColor = object.LeftLegColor
  2891. rightArm.BrickColor = object.RightArmColor
  2892. rightLeg.BrickColor = object.RightLegColor
  2893. torso.BrickColor = object.TorsoColor
  2894. elseif object:IsA("Hat") then
  2895. local handle = object:FindFirstChild("Handle")
  2896. if handle and handle:IsA("BasePart") then
  2897. local weld = Instance.new("Weld", head)
  2898. weld.C0 = CFrame.new(0, 0.5, 0)
  2899. local attachmentPos = object.AttachmentPos
  2900. local attachmentRight = object.AttachmentRight
  2901. local attachmentUp = object.AttachmentUp
  2902. local attachmentForward = object.AttachmentForward
  2903. weld.C1 = CFrame.new(attachmentPos.X, attachmentPos.Y, attachmentPos.Z,
  2904. attachmentRight.X, attachmentUp.X, -attachmentForward.X,
  2905. attachmentRight.Y, attachmentUp.Y, -attachmentForward.Y,
  2906. attachmentRight.Z, attachmentUp.Z, -attachmentForward.Z)
  2907. weld.Name = "HeadWeld"
  2908. weld.Part0 = head
  2909. weld.Part1 = handle
  2910. handle.Parent = model
  2911. local antiGravity = Instance.new("BodyForce", handle)
  2912. antiGravity.force = Vector3.new(0, handle:GetMass() * 196.2, 0)
  2913. objects[object] = false
  2914. object.Parent = nil
  2915. objects[weld] = true
  2916. end
  2917. end
  2918. object.Parent = model
  2919. end
  2920. local facePresent = false
  2921. local headMeshPresent = false
  2922. for _, template in ipairs(appearance.headObjects) do
  2923. local object = template:Clone()
  2924. local newObjects = {object}
  2925. for _, object in ipairs(newObjects) do
  2926. objects[object] = true
  2927. for _, child in ipairs(object:GetChildren()) do
  2928. table.insert(newObjects, child)
  2929. end
  2930. end
  2931. if object:IsA("DataModelMesh") then
  2932. headMeshPresent = true
  2933. elseif object:IsA("Decal") then
  2934. facePresent = true
  2935. end
  2936. object.Parent = head
  2937. end
  2938. if not facePresent then
  2939. local face = Instance.new("Decal", head)
  2940. face.Texture = "rbxasset://textures/face.png"
  2941. objects[face] = true
  2942. end
  2943. if not headMeshPresent then
  2944. local headMesh = Instance.new("SpecialMesh", head)
  2945. headMesh.Scale = Vector3.new(1.25, 1.25, 1.25)
  2946. objects[headMesh] = true
  2947. end
  2948. table.insert(connections, model.DescendantAdded:connect(function(object)
  2949. local success, is_localscript = pcall(Game.IsA, object, "LocalScript")
  2950. if success and is_localscript then
  2951. pcall(Utility.SetProperty, object, "Disabled", true)
  2952. local changed_connection = pcall(object.Changed.connect, object.Changed, function(property)
  2953. if property == "Disabled" and not object.Disabled then
  2954. pcall(Utility.SetProperty, object, "Disabled", true)
  2955. object:Destroy()
  2956. end
  2957. end)
  2958. end
  2959. if not objects[object] then
  2960. object:Destroy()
  2961. end
  2962. end))
  2963. model.Parent = Workspace
  2964. Player.Character = model
  2965. Camera.CameraSubject = humanoid
  2966. Camera.CameraType = "Track"
  2967. Camera.CoordinateFrame = cameraCFrame
  2968. local IsStanding
  2969. local RegenerateHealth
  2970. local ResetCharacter
  2971. function IsStanding()
  2972. return not not next(feetTouching)
  2973. end
  2974. function RegenerateHealth()
  2975. if humanoid.Health < 1 then
  2976. humanoid.Health = 100
  2977. elseif not regeneratingHealth then
  2978. regeneratingHealth = true
  2979. local elapsedTime = wait(1)
  2980. regeneratingHealth = false
  2981. if humanoid.Health < 100 then
  2982. humanoid.Health = math.min(humanoid.Health + elapsedTime, 100)
  2983. end
  2984. end
  2985. end
  2986. function ResetCharacter()
  2987. for index, connection in ipairs(connections) do
  2988. connection:disconnect()
  2989. end
  2990. active = false
  2991. end
  2992. table.insert(connections, model.AncestryChanged:connect(ResetCharacter))
  2993. table.insert(connections, model.DescendantRemoving:connect(function(object)
  2994. local parent = forcefields[object]
  2995. if parent then
  2996. forcefields[object] = nil
  2997. local new_forcefield = Instance.new("ForceField")
  2998. forcefields[new_forcefield] = parent
  2999. objects[new_forcefield] = true
  3000. new_forcefield.Parent = parent
  3001. elseif objects[object] then
  3002. ResetCharacter()
  3003. end
  3004. end))
  3005. table.insert(connections, humanoid.HealthChanged:connect(RegenerateHealth))
  3006. table.insert(connections, humanoid.Climbing:connect(function() pose = "Climbing" end))
  3007. table.insert(connections, humanoid.FallingDown:connect(function(state) pose = "FallingDown" end))
  3008. table.insert(connections, humanoid.FreeFalling:connect(function(state) pose = "FreeFall" if state then soundFreeFalling:Play() else
  3009.  
  3010. soundFreeFalling:Pause() end end))
  3011. table.insert(connections, humanoid.GettingUp:connect(function(state) pose = "GettingUp" if state then soundGettingUp:Play() else
  3012.  
  3013. soundGettingUp:Pause() end end))
  3014. table.insert(connections, humanoid.PlatformStanding:connect(function() pose = "PlatformStanding" end))
  3015. table.insert(connections, humanoid.Seated:connect(function() pose = "Seated" end))
  3016. table.insert(connections, humanoid.Swimming:connect(function(speed) if speed > 0 then pose = "Swimming" else pose = "Standing" end end))
  3017. local previousRootPartCFrame = rootPart.CFrame
  3018. TaskScheduler.Start(function()
  3019. while active do
  3020. local totalTime = TaskScheduler.GetCurrentTime()
  3021. local stepTime = 1 / 60
  3022. if not PlayerControl.characterEnabled then
  3023. ResetCharacter()
  3024. break
  3025. end
  3026. torsoLight.Brightness = 0.5 + 0.15 * math.sin(totalTime * 0.75 * math.pi)
  3027. local featherfallEnabled = PlayerControl.IsFeatherfallEnabled()
  3028. local rootPartCFrame = rootPart.CFrame
  3029. if not jumpDebounce and UserInterface:IsKeyDown(Enum.KeyCode.Space) then
  3030. if humanoid.Sit then
  3031. humanoid.Sit = false
  3032. end
  3033. if IsStanding() then
  3034. jumpDebounce = true
  3035. pose = "Jumping"
  3036. rootPart.Velocity = Vector3.new(rootPart.Velocity.X, 50, rootPart.Velocity.Z)
  3037. torso.Velocity = Vector3.new(torso.Velocity.X, 50, torso.Velocity.Z)
  3038. TaskScheduler.Schedule(1, function()
  3039. if pose == "Jumping" then
  3040. pose = "FreeFall"
  3041. end
  3042. jumpDebounce = false
  3043. humanoid.Jump = false
  3044. end)
  3045. end
  3046. end
  3047. local cameraCFrame = Camera.CoordinateFrame
  3048. local cameraDirection = cameraCFrame.lookVector
  3049. if flying then
  3050. if PlayerControl.rolling then
  3051. local rootPartCFrame = rootPart.CFrame
  3052. local speed = (rootPartCFrame - rootPartCFrame.p):pointToObjectSpace(rootPart.Velocity).Y
  3053. local decay = 0.5 ^ stepTime
  3054. if math.abs(speed) <= 50 then
  3055. PlayerControl.rollingAngle = (((PlayerControl.rollingAngle + 0.5) % 1 - 0.5) * decay) % 1
  3056. PlayerControl.rollingOffset = PlayerControl.rollingOffset * decay
  3057. else
  3058. PlayerControl.rollingAngle = (PlayerControl.rollingAngle + stepTime * speed * PlayerControl.rollingSpeed) % 1
  3059. PlayerControl.rollingOffset = (PlayerControl.rollingOffset + PlayerControl.rollingMaxOffset * (1 / decay - 1)) * decay
  3060. end
  3061. 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)
  3062. else
  3063. rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  3064. PlayerControl.rollingAngle = 0
  3065. PlayerControl.rollingOffset = 0
  3066. end
  3067. rightShoulder.MaxVelocity = 0.5
  3068. leftShoulder.MaxVelocity = 0.5
  3069. rightShoulder.DesiredAngle = 0
  3070. leftShoulder.DesiredAngle = 0
  3071. rightHip.DesiredAngle = 0
  3072. leftHip.DesiredAngle = 0
  3073. bodyGyro.D = 500
  3074. bodyGyro.P = 1e6
  3075. bodyGyro.maxTorque = Vector3.new(1e6, 1e6, 1e6)
  3076. bodyVelocity.P = 1250
  3077. bodyVelocity.maxForce = Vector3.new(1e6, 1e6, 1e6)
  3078. local movementRight = 0
  3079. local movementForward = 0
  3080. local movementUp = 0
  3081. if UserInterface:IsKeyDown(Enum.KeyCode.A) and not UserInterface:IsKeyDown(Enum.KeyCode.D) then
  3082. movementRight = -1
  3083. elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then
  3084. movementRight = 1
  3085. end
  3086. if UserInterface:IsKeyDown(Enum.KeyCode.W) then
  3087. movementUp = 0.2
  3088. if not UserInterface:IsKeyDown(Enum.KeyCode.S) then
  3089. movementForward = -1
  3090. end
  3091. elseif UserInterface:IsKeyDown(Enum.KeyCode.S) then
  3092. movementForward = 1
  3093. end
  3094. local movement = PlayerControl.fly_acceleration * cameraCFrame:vectorToWorldSpace(Vector3.new(movementRight, movementUp, movementForward))
  3095. local previousMomentum = flyingMomentum
  3096. local previousTilt = flyingTilt
  3097. flyingMomentum = movement + flyingMomentum * (1 - PlayerControl.fly_acceleration / PlayerControl.fly_speed)
  3098. flyingTilt = ((flyingMomentum * Vector3.new(1, 0, 1)).unit:Cross((previousMomentum * Vector3.new(1, 0, 1)).unit)).Y
  3099. if flyingTilt ~= flyingTilt or flyingTilt == math.huge then
  3100. flyingTilt = 0
  3101. end
  3102. local absoluteTilt = math.abs(flyingTilt)
  3103. if absoluteTilt > 0.06 or absoluteTilt < 0.0001 then
  3104. if math.abs(previousTilt) > 0.0001 then
  3105. flyingTilt = previousTilt * 0.9
  3106. else
  3107. flyingTilt = 0
  3108. end
  3109. else
  3110. flyingTilt = previousTilt * 0.77 + flyingTilt * 0.25
  3111. end
  3112. previousTilt = flyingTilt
  3113. if flyingMomentum.magnitude < 0.1 then
  3114. flyingMomentum = Vector3.new(0, 0, 0)
  3115. -- bodyGyro.cframe = cameraCFrame
  3116. else
  3117. local momentumOrientation = CFrame.new(Vector3.new(0, 0, 0), flyingMomentum)
  3118. local tiltOrientation = CFrame.Angles(0, 0, -20 * flyingTilt)
  3119. bodyGyro.cframe = momentumOrientation * tiltOrientation * CFrame.Angles(-0.5 * math.pi * math.min(flyingMomentum.magnitude / PlayerControl.fly_speed, 1), 0, 0)
  3120. end
  3121. bodyVelocity.velocity = flyingMomentum + Vector3.new(0, 0.15695775618683547, 0)
  3122. rootPart.Velocity = flyingMomentum
  3123. previousMomentum = flyingMomentum
  3124. else
  3125. rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  3126. PlayerControl.rollingAngle = 0
  3127. PlayerControl.rollingOffset = 0
  3128. bodyGyro.D = 3250
  3129. bodyGyro.P = 400000
  3130. bodyVelocity.P = 5000
  3131. local cameraDirection = cameraCFrame.lookVector
  3132. local walkDirection = Vector3.new(0, 0, 0)
  3133. local walkSpeed = 16
  3134. if UserInterface:IsKeyDown(Enum.KeyCode.W) then
  3135. if UserInterface:IsKeyDown(Enum.KeyCode.A) then
  3136. walkDirection = Vector3.new(cameraDirection.X + cameraDirection.Z, 0, cameraDirection.Z - cameraDirection.X).unit
  3137. elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then
  3138. walkDirection = Vector3.new(cameraDirection.X - cameraDirection.Z, 0, cameraDirection.Z + cameraDirection.X).unit
  3139. else
  3140. walkDirection = Vector3.new(cameraDirection.X, 0, cameraDirection.Z).unit
  3141. end
  3142. elseif UserInterface:IsKeyDown(Enum.KeyCode.S) then
  3143. if UserInterface:IsKeyDown(Enum.KeyCode.A) then
  3144. walkDirection = Vector3.new(-cameraDirection.X + cameraDirection.Z, 0, -cameraDirection.Z - cameraDirection.X).unit
  3145. elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then
  3146. walkDirection = Vector3.new(-cameraDirection.X - cameraDirection.Z, 0, -cameraDirection.Z + cameraDirection.X).unit
  3147. else
  3148. walkDirection = Vector3.new(-cameraDirection.X, 0, -cameraDirection.Z).unit
  3149. end
  3150. elseif UserInterface:IsKeyDown(Enum.KeyCode.A) then
  3151. walkDirection = Vector3.new(cameraDirection.Z, 0, -cameraDirection.X).unit
  3152. elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then
  3153. walkDirection = Vector3.new(-cameraDirection.Z, 0, cameraDirection.X).unit
  3154. else
  3155. walkSpeed = 0
  3156. end
  3157. if walkSpeed ~= previousWalkSpeed then
  3158. if walkSpeed > 0 then
  3159. soundRunning:Play()
  3160. else
  3161. soundRunning:Pause()
  3162. end
  3163. end
  3164. if walkSpeed > 0 then
  3165. if pose ~= "Jumping" then
  3166. if IsStanding() then
  3167. pose = "Running"
  3168. else
  3169. pose = "FreeFall"
  3170. end
  3171. end
  3172. bodyGyro.cframe = CFrame.new(Vector3.new(), walkDirection)
  3173. bodyGyro.maxTorque = Vector3.new(1000000000, 1000000000, 1000000000)
  3174. bodyVelocity.maxForce = Vector3.new(1000000, maxForceY, 1000000)
  3175. else
  3176. if pose ~= "Jumping" then
  3177. if IsStanding() then
  3178. pose = "Standing"
  3179. else
  3180. pose = "FreeFall"
  3181. end
  3182. end
  3183. -- TODO: find and fix bug that causes torso to rotate back to some angle
  3184. bodyGyro.maxTorque = Vector3.new(1000000000, 1000000000, 1000000000) -- Vector3.new(1000000000, 0, 1000000000)
  3185. if PlayerControl.pushable then
  3186. bodyVelocity.maxForce = Vector3.new(0, 0, 0)
  3187. else
  3188. bodyVelocity.maxForce = Vector3.new(1000000, 0, 1000000)
  3189. end
  3190. end
  3191. if featherfallEnabled then
  3192. local velocity = rootPart.Velocity
  3193. if velocity.Y > 50 then
  3194. rootPart.Velocity = Vector3.new(velocity.X, 50, velocity.Z)
  3195. elseif velocity.Y < -50 then
  3196. rootPart.Velocity = Vector3.new(velocity.X, -50, velocity.Z)
  3197. end
  3198. local distanceVector = rootPartCFrame.p - previousRootPartCFrame.p
  3199. local offsetX, offsetY, offsetZ = distanceVector.X, distanceVector.Y, distanceVector.Z
  3200. local MAX_MOVEMENT = 50 * 0.03333333507180214
  3201. if offsetX > MAX_MOVEMENT then
  3202. offsetX = MAX_MOVEMENT
  3203. elseif offsetX < -MAX_MOVEMENT then
  3204. offsetX = -MAX_MOVEMENT
  3205. end
  3206. if offsetY > MAX_MOVEMENT then
  3207. offsetY = MAX_MOVEMENT
  3208. elseif offsetY < -MAX_MOVEMENT then
  3209. offsetY = -MAX_MOVEMENT
  3210. end
  3211. if offsetZ > MAX_MOVEMENT then
  3212. offsetZ = MAX_MOVEMENT
  3213. elseif offsetZ < -MAX_MOVEMENT then
  3214. offsetZ = -MAX_MOVEMENT
  3215. end
  3216. local offset = Vector3.new(offsetX, offsetY, offsetZ)
  3217. if offset ~= distanceVector then
  3218. rootPartCFrame = previousRootPartCFrame + offset
  3219. --rootPart.CFrame = rootPartCFrame
  3220. end
  3221. end
  3222. local walkingVelocity = walkDirection * walkSpeed
  3223. bodyVelocity.velocity = walkingVelocity
  3224. if not jumpDebounce and math.abs(rootPart.Velocity.Y) <= 0.1 then
  3225. rootPart.Velocity = Vector3.new(walkingVelocity.X, rootPart.Velocity.Y, walkingVelocity.Z)
  3226. end
  3227. previousWalkSpeed = walkSpeed
  3228. if pose == "Jumping" or jumpDebounce then
  3229. rightShoulder.MaxVelocity = 0.5
  3230. leftShoulder.MaxVelocity = 0.5
  3231. rightShoulder.DesiredAngle = 3.14
  3232. leftShoulder.DesiredAngle = -3.14
  3233. rightHip.DesiredAngle = 0
  3234. leftHip.DesiredAngle = 0
  3235. elseif pose == "FreeFall" then
  3236. rightShoulder.MaxVelocity = 0.5
  3237. leftShoulder.MaxVelocity = 0.5
  3238. rightShoulder.DesiredAngle = 3.14
  3239. leftShoulder.DesiredAngle = -3.14
  3240. rightHip.DesiredAngle = 0
  3241. leftHip.DesiredAngle = 0
  3242. elseif pose == "Seated" then
  3243. rightShoulder.MaxVelocity = 0.15
  3244. leftShoulder.MaxVelocity = 0.15
  3245. rightShoulder.DesiredAngle = 3.14 / 2
  3246. leftShoulder.DesiredAngle = -3.14 / 2
  3247. rightHip.DesiredAngle = 3.14 / 2
  3248. leftHip.DesiredAngle = -3.14 / 2
  3249. else
  3250. local climbFudge = 0
  3251. local amplitude
  3252. local frequency
  3253. if pose == "Running" then
  3254. rightShoulder.MaxVelocity = 0.15
  3255. leftShoulder.MaxVelocity = 0.15
  3256. amplitude = 1
  3257. frequency = 9
  3258. elseif (pose == "Climbing") then
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement