Advertisement
deezfai

Untitled

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