Advertisement
pitrioptixiop

Gatekeeper Fixed

Oct 27th, 2020
782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 298.78 KB | None | 0 0
  1. -- Hi, noliCAIKS/RPFeltz here! 2015/02/01
  2. -- Old version of the script was leaked so now it's worthless,
  3. -- so I can't get any money for it anymore. So I'll just share
  4. -- the code of the latest version now.
  5. -- The code is broken as a whole but many of the components
  6. -- are still functional. Maybe you can make your own module
  7. -- loader to fix it. Use the code of the modules as you please.
  8. -- If you can get local loadstring to work, that should fix
  9. -- everything. Good luck.
  10. NewLocalScript = NLS
  11. NewScript = NS
  12. local session_id = math.floor(tick() * 10)
  13. local local_script_template = script
  14. local source_value_name
  15. --local_script_template.Disabled = true
  16. for _, child in ipairs(local_script_template:GetChildren()) do
  17. if child:IsA("StringValue") then
  18. if string.lower(child.Name) ~= "owner" then
  19. source_value_name = child.Name
  20. end
  21. child.Value = ""
  22. break
  23. end
  24. end
  25. script:ClearAllChildren()
  26. script.Parent = nil
  27. if not source_value_name then
  28. source_value_name = ...
  29. if source_value_name then
  30. local source_value = Instance.new("StringValue", local_script_template)
  31. source_value.Name = source_value_name
  32. else
  33. if not (NewLocalScript and NewScript) then
  34. print("Script builder is incompatible.")
  35. end
  36. source_value_name = "Source"
  37. local_script_template = nil
  38. end
  39. end
  40. local Module = {}
  41. Module.name = "Module"
  42. Module.source = string.format([[
  43. local _ENV = {
  44. Axes = {
  45. new = Axes.new
  46. },
  47. BrickColor = {
  48. Black = BrickColor.Black,
  49. Blue = BrickColor.Blue,
  50. DarkGray = BrickColor.DarkGray,
  51. Gray = BrickColor.Gray,
  52. Green = BrickColor.Green,
  53. New = BrickColor.New,
  54. Random = BrickColor.Random,
  55. Red = BrickColor.Red,
  56. White = BrickColor.White,
  57. Yellow = BrickColor.Yellow,
  58. new = BrickColor.new,
  59. palette = BrickColor.palette,
  60. random = BrickColor.random
  61. },
  62. CFrame = {
  63. Angles = CFrame.Angles,
  64. fromAxisAngle = CFrame.fromAxisAngle,
  65. fromEulerAnglesXYZ = CFrame.fromEulerAnglesXYZ,
  66. new = CFrame.new
  67. },
  68. CellId = {
  69. new = CellId.new
  70. },
  71. Color3 = {
  72. new = Color3.new
  73. },
  74. Delay = Delay,
  75. Enum = Enum,
  76. Faces = {
  77. new = Faces.new
  78. },
  79. Game = Game,
  80. Instance = {
  81. Lock = Instance.Lock,
  82. Unlock = Instance.Unlock,
  83. new = Instance.new
  84. },
  85. LoadLibrary = LoadLibrary,
  86. LoadRobloxLibrary = LoadRobloxLibrary,
  87. PluginManager = PluginManager,
  88. Ray = {
  89. new = Ray.new
  90. },
  91. Region3 = {
  92. new = Region3.new
  93. },
  94. Region3int16 = {
  95. new = Region3int16.new
  96. },
  97. Spawn = Spawn,
  98. Stats = Stats,
  99. UDim = {
  100. new = UDim.new
  101. },
  102. UDim2 = {
  103. new = UDim2.new
  104. },
  105. UserSettings = UserSettings,
  106. Vector2 = {
  107. new = Vector2.new
  108. },
  109. Vector2int16 = {
  110. new = Vector2int16.new
  111. },
  112. Vector3 = {
  113. FromAxis = Vector3.FromAxis,
  114. FromNormalId = Vector3.FromNormalId,
  115. new = Vector3.new
  116. },
  117. Vector3int16 = {
  118. new = Vector3int16.new
  119. },
  120. Version = Version,
  121. Wait = Wait,
  122. Workspace = Workspace,
  123. _G = _G,
  124. _VERSION = _VERSION,
  125. assert = assert,
  126. collectgarbage = collectgarbage,
  127. coroutine = {
  128. create = coroutine.create,
  129. resume = coroutine.resume,
  130. running = coroutine.running,
  131. status = coroutine.status,
  132. wrap = coroutine.wrap,
  133. yield = coroutine.yield
  134. },
  135. crash__ = crash__,
  136. delay = delay,
  137. dofile = dofile,
  138. error = error,
  139. game = game,
  140. gcinfo = gcinfo,
  141. getfenv = getfenv,
  142. getmetatable = getmetatable,
  143. ipairs = ipairs,
  144. load = load,
  145. loadfile = loadfile,
  146. loadstring = loadstring,
  147. math = {
  148. abs = math.abs,
  149. acos = math.acos,
  150. asin = math.asin,
  151. atan = math.atan,
  152. atan2 = math.atan2,
  153. ceil = math.ceil,
  154. cos = math.cos,
  155. cosh = math.cosh,
  156. deg = math.deg,
  157. exp = math.exp,
  158. floor = math.floor,
  159. fmod = math.fmod,
  160. frexp = math.frexp,
  161. huge = math.huge,
  162. ldexp = math.ldexp,
  163. log = math.log,
  164. log10 = math.log10,
  165. max = math.max,
  166. min = math.min,
  167. modf = math.modf,
  168. phi = 1.618033988749895,
  169. pi = math.pi,
  170. pow = math.pow,
  171. rad = math.rad,
  172. random = math.random,
  173. randomseed = math.randomseed,
  174. sin = math.sin,
  175. sinh = math.sinh,
  176. sqrt = math.sqrt,
  177. tan = math.tan,
  178. tanh = math.tanh,
  179. tau = 2 * math.pi
  180. },
  181. newproxy = newproxy,
  182. next = next,
  183. pairs = pairs,
  184. pcall = pcall,
  185. print = print,
  186. printidentity = printidentity,
  187. rawequal = rawequal,
  188. rawget = rawget,
  189. rawset = rawset,
  190. select = select,
  191. setfenv = setfenv,
  192. setmetatable = setmetatable,
  193. settings = settings,
  194. shared = shared,
  195. stats = stats,
  196. string = {
  197. byte = string.byte,
  198. char = string.char,
  199. dump = string.dump,
  200. find = string.find,
  201. format = string.format,
  202. gfind = string.gfind,
  203. gmatch = string.gmatch,
  204. gsub = string.gsub,
  205. len = string.len,
  206. lower = string.lower,
  207. match = string.match,
  208. rep = string.rep,
  209. reverse = string.reverse,
  210. sub = string.sub,
  211. upper = string.upper
  212. },
  213. table = {
  214. concat = table.concat,
  215. foreach = table.foreach,
  216. foreachi = table.foreachi,
  217. getn = table.getn,
  218. insert = table.insert,
  219. maxn = table.maxn,
  220. remove = table.remove,
  221. setn = table.setn,
  222. sort = table.sort
  223. },
  224. tick = tick,
  225. time = time,
  226. tonumber = tonumber,
  227. tostring = tostring,
  228. type = type,
  229. unpack = unpack,
  230. version = version,
  231. wait = wait,
  232. workspace = workspace,
  233. xpcall = xpcall,
  234. ypcall = ypcall
  235. }
  236. _ENV.Environment = ...
  237. _ENV.Environment._ENV = _ENV
  238. local _RBX = getfenv()
  239. _ENV._ENV = _ENV
  240. _ENV._RBX = _RBX
  241. _ENV._SessionID = %s
  242. _ENV.Debris = Game:GetService("Debris")
  243. _ENV.InsertService = Game:GetService("InsertService")
  244. _ENV.Lighting = Game:GetService("Lighting")
  245. _ENV.LogService = Game:GetService("LogService")
  246. _ENV.Players = Game:GetService("Players")
  247. _ENV.RunService = Game:GetService("RunService")
  248. _ENV.ReplicatedStorage = Game:GetService("ReplicatedStorage")
  249. _ENV.SoundService = Game:GetService("SoundService")
  250. _ENV.StarterGui = Game:GetService("StarterGui")
  251. _ENV.StarterPack = Game:GetService("StarterPack")
  252. _ENV.TeleportService = Game:GetService("TeleportService")
  253. _ENV.RbxUtility = LoadLibrary("RbxUtility")
  254. if N_ENV then
  255. N_ENV(_ENV)
  256. end
  257. local Module = ...
  258. Module.data = {
  259. listeners = {},
  260. modules = {}
  261. }
  262. Module.metatable = {}
  263. function Module.metatable:__tostring()
  264. return tostring(self.name)
  265. end
  266. function Module.Create(name, source, ...)
  267. local module = Module.Store(name, source)
  268. Module.Initialize(module, ...)
  269. return module
  270. end
  271. function Module.Initialize(module, ...)
  272. local name = module.name
  273. local load_function, message = loadstring(module.source, name)
  274. if load_function then
  275. local success, message = ypcall(setfenv(load_function, _ENV), ...)
  276. if success then
  277. if _ENV.Logger and _ENV.Logger.printf then
  278. _ENV.Logger.printf("Output", "%%s: ready", tostring(name))
  279. end
  280. local listeners = Module.data.listeners
  281. local listener = listeners[name]
  282. if listener then
  283. listeners[name] = nil
  284. listener:fire()
  285. end
  286. return module
  287. elseif _ENV.Logger and _ENV.Logger.printf then
  288. _ENV.Logger.printf("Severe", "Runtime error in module '%%s': %%s", tostring(name), message)
  289. else
  290. print(string.format("runtime error in module '%%s': %%s", tostring(name), message))
  291. end
  292. elseif _ENV.Logger and _ENV.Logger.printf then
  293. _ENV.Logger.printf("Severe", "Syntax error in module '%%s': %%s", tostring(name), message)
  294. else
  295. print(string.format("syntax error in module '%%s': %%s", tostring(name), message))
  296. end
  297. end
  298. function Module.Load(name)
  299. return Module.data.modules[name]
  300. end
  301. function Module.Register(module)
  302. local name = tostring(module)
  303. _ENV[name] = module
  304. Module.data.modules[name] = module
  305. end
  306. function Module.Reload(name, source, ...)
  307. local module = Module.Load(name)
  308. for key in pairs(module) do
  309. module[key] = nil
  310. end
  311. module.name = name
  312. module.source = source
  313. Module.Initialize(module, ...)
  314. return module
  315. end
  316. function Module.Store(name, source)
  317. local module = {}
  318. module.name = name
  319. module.source = source
  320. setmetatable(module, Module.metatable)
  321. Module.Register(module)
  322. return module
  323. end
  324. function Module.WaitForModule(name)
  325. local module = Module.Load(name)
  326. if not module then
  327. local listeners = Module.data.listeners
  328. local listener = listeners[name]
  329. if not listener then
  330. listener = _ENV.RbxUtility.CreateSignal()
  331. listeners[name] = listener
  332. end
  333. listener:wait()
  334. end
  335. end
  336. ]], tostring(session_id))
  337. assert(loadstring(Module.source))(Module)
  338. setmetatable(Module, Module.metatable)
  339. Module.Register(Module)
  340. Module.Create("LuaEnum", [[
  341. LuaEnum.enum_metatable = {
  342. __call = function(self, value)
  343. local valueType = type(value)
  344. if valueType == "table" and getmetatable(value) == LuaEnum.enum_item_metatable then
  345. return value
  346. else
  347. return self[value]
  348. end
  349. end,
  350. __index = function(self, key)
  351. local enumItem = self.ItemsByName[key] or self.ItemsByValue[key]
  352. if enumItem == nil then
  353. local default = self.Default
  354. if default then
  355. Logger.printf("Warning", "%s is not a valid EnumItem, returning default (%s)", Utility.ToString(key), tostring(default))
  356. enumItem = default
  357. else
  358. Logger.errorf(2, "%s is not a valid EnumItem", Utility.ToString(key))
  359. end
  360. end
  361. return enumItem
  362. end,
  363. __tostring = function(self)
  364. return self.Name
  365. end
  366. }
  367. LuaEnum.enum_item_metatable = {
  368. __tostring = function(self)
  369. return self.Enum.Name .. "." .. self.Name
  370. end
  371. }
  372. LuaEnum.init_metatable = {
  373. __call = function(self, items)
  374. local enumItemsByName = {}
  375. local enumItemsByValue = {}
  376. local enum = {
  377. ItemsByName = enumItemsByName,
  378. ItemsByValue = enumItemsByValue,
  379. Name = self[1]
  380. }
  381. local default = items.Default
  382. if default ~= nil then
  383. items.Default = nil
  384. end
  385. for value, name in pairs(items) do
  386. local enumItem = setmetatable({
  387. Enum = enum,
  388. Name = name,
  389. Value = value
  390. }, LuaEnum.enum_item_metatable)
  391. enumItemsByName[name] = enumItem
  392. enumItemsByValue[value] = enumItem
  393. if name == default or value == default then
  394. enum.Default = enumItem
  395. end
  396. end
  397. return setmetatable(enum, LuaEnum.enum_metatable)
  398. end
  399. }
  400. function LuaEnum.new(name)
  401. return setmetatable({name}, LuaEnum.init_metatable)
  402. end
  403. ]])
  404. Module.Create("Logger", [[
  405. Logger.entries = {0}
  406. Logger.MessageType = LuaEnum.new "MessageType" {
  407. "Output",
  408. "Info",
  409. "Warning",
  410. "Severe",
  411. "Error",
  412. Default = "Severe"
  413. }
  414. Logger.MESSAGE_TYPE_SETTINGS = {
  415. { -- Output
  416. Font = "Arial",
  417. TextColor3 = Color3.new(0, 0, 0)
  418. },
  419. { -- Info
  420. Font = "Arial",
  421. TextColor3 = Color3.new(0, 0, 1)
  422. },
  423. { -- Warning
  424. Font = "ArialBold",
  425. TextColor3 = Color3.new(1, 0.5, 0)
  426. },
  427. { -- Severe/Error
  428. Font = "ArialBold",
  429. TextColor3 = Color3.new(1, 0, 0)
  430. }
  431. }
  432. Logger.MAX_ENTRIES = 160
  433. Logger.WARNING_TRACE_ITEM_COUNT = 5
  434. Logger.rbxPrint = getfenv(RbxUtility.CreateSignal).print
  435. function Logger.error(level, message)
  436. message = message .. "\n" .. Logger.StackTraceToString(Logger.GenerateStackTrace(level + 1))
  437. Logger.AddEntry {Logger.MessageType.Error, message}
  438. error(level + 1, message)
  439. end
  440. function Logger.errorf(level, messageFormat, ...)
  441. Logger.error(level + 1, string.format(messageFormat, ...))
  442. end
  443. function Logger.print(messageType, message, level)
  444. messageType = Logger.MessageType(messageType)
  445. local entry = {messageType, message}
  446. Logger.rbxPrint(Logger.EntryToString(entry))
  447. Logger.AddEntry(entry)
  448. if Network and Network.Print then
  449. Network.Print(messageType.Value, message)
  450. end
  451. if level ~= false and messageType.Value >= Logger.MessageType.Warning.Value then
  452. local maxItems
  453. if messageType.Value >= Logger.MessageType.Severe.Value then
  454. maxItems = math.huge
  455. else
  456. maxItems = Logger.WARNING_TRACE_ITEM_COUNT
  457. end
  458. local trace = Logger.GenerateStackTrace((level or 1) + 1, math.huge, 10, maxItems + 1)
  459. local traceLength = #trace
  460. local stackTraceMessage
  461. local suffix = ""
  462. if traceLength > maxItems then
  463. trace[traceLength] = nil
  464. suffix = "\n..."
  465. end
  466. Logger.print("Info", "Stack trace:\n" .. Logger.StackTraceToString(trace) .. suffix .. "\nStack end", false)
  467. end
  468. end
  469. function Logger.printf(messageType, messageFormat, ...)
  470. Logger.print(messageType, string.format(messageFormat, ...), 2)
  471. end
  472. function Logger.AddEntry(entry)
  473. local entries = Logger.entries
  474. if entries[1] >= Logger.MAX_ENTRIES then
  475. local first = entries[2]
  476. local nextFirst = first[2]
  477. first[1] = nil
  478. first[2] = nil
  479. entries[1] = entries[1] - 1
  480. entries[2] = nextFirst
  481. if not nextFirst then
  482. entries[3] = nil
  483. end
  484. end
  485. local last = entries[3]
  486. local node = {entry}
  487. if last then
  488. entries[3] = node
  489. last[2] = node
  490. else
  491. entries[2] = node
  492. entries[3] = node
  493. end
  494. entries[1] = entries[1] + 1
  495. end
  496. function Logger.NodeIterator(list, node)
  497. if node then
  498. node = node[2]
  499. else
  500. node = list[2]
  501. end
  502. if node then
  503. return node, node[1]
  504. end
  505. end
  506. function Logger.EntryToString(entry)
  507. local messageType, message = entry[1], tostring(entry[2])
  508. if messageType and messageType.Value >= Logger.MessageType.Info.Value then
  509. return messageType.Name .. ": " .. message
  510. else
  511. return message
  512. end
  513. end
  514. function Logger.GenerateStackTrace(level, maxLevel, maxTailCalls, maxTraceItems)
  515. level = level + 2
  516. if maxLevel == nil then
  517. maxLevel = math.huge
  518. else
  519. maxLevel = maxLevel + 2
  520. end
  521. maxTailCalls = maxTailCalls or 10
  522. maxTraceItems = maxTraceItems or math.huge
  523. local trace = {}
  524. local numTailCalls = 0
  525. while level <= maxLevel and numTailCalls <= maxTailCalls and #trace < maxTraceItems do
  526. local success, errorMessage = xpcall(function() error("-", level + 1) end, function(...) return ... end)
  527. if errorMessage == "-" then
  528. numTailCalls = numTailCalls + 1
  529. else
  530. if numTailCalls > 0 then
  531. local traceSize = #trace
  532. if traceSize > 0 then
  533. trace[#trace][3] = numTailCalls
  534. end
  535. numTailCalls = 0
  536. end
  537. local script, line = string.match(errorMessage, "(.*):(%d+)")
  538. trace[#trace + 1] = {script, tonumber(line), 0}
  539. end
  540. level = level + 1
  541. end
  542. return trace
  543. end
  544. function Logger.StackTraceToString(trace)
  545. local buffer = {}
  546. for _, data in ipairs(trace) do
  547. buffer[#buffer + 1] = string.format("Script %q, line %d", data[1], data[2])
  548. local numTailCalls = data[3]
  549. if numTailCalls == 1 then
  550. buffer[#buffer + 1] = "... 1 tail call"
  551. elseif numTailCalls > 1 then
  552. buffer[#buffer + 1] = string.format("... %d tail calls", numTailCalls)
  553. end
  554. end
  555. return table.concat(buffer, "\n")
  556. end
  557. function Logger.MessageOutFunc(message, messageType)
  558. if AdvancedGUI and AdvancedGUI.Print then
  559. local messageTypeValue
  560. if messageType == Enum.MessageType.MessageOutput then
  561. local tagName, untaggedMessage = string.match(message, "(%a+): (.*)")
  562. if tagName == "Info" or tagName == "Warning" or tagName == "Severe" then
  563. messageTypeValue = Logger.MessageType[tagName].Value
  564. message = untaggedMessage
  565. else
  566. messageTypeValue = Logger.MessageType.Output.Value
  567. end
  568. else
  569. messageTypeValue = messageType.Value + 1
  570. end
  571. AdvancedGUI.PrintFormat(Logger.MESSAGE_TYPE_SETTINGS[messageTypeValue], message)
  572. end
  573. end
  574. function print(...)
  575. local args = {...}
  576. local buffer = {}
  577. for index = 1, select("#", ...) do
  578. buffer[index] = tostring(args[index])
  579. end
  580. local message = table.concat(buffer, "\t")
  581. Logger.print("Output", message)
  582. end
  583. LogService.MessageOut:connect(function(message, messageType)
  584. Logger.MessageOutFunc(message, messageType)
  585. end)
  586. ]])
  587. Module.Create("Utility", [=[
  588. math.randomseed(tick())
  589. function Utility.BlockRobloxFilter(text)
  590. return string.gsub(text, ".", "%1\143")
  591. end
  592. function Utility.ExecuteLua(source, ...)
  593. local execute, syntaxErrorMessage = loadstring(source)
  594. if execute then
  595. local success, runtimeErrorMessage = ypcall(setfenv(execute, _ENV), ...)
  596. if not success then
  597. Logger.printf("Severe", "Runtime error in Utility.ExecuteLua: %s", runtimeErrorMessage)
  598. end
  599. else
  600. Logger.printf("Severe", "Syntax error in Utility.ExecuteLua: %s", syntaxErrorMessage)
  601. end
  602. end
  603.  
  604. local function IsBrickColor(object)
  605. local _ = object.Color
  606. end
  607. local function IsCFrame(object)
  608. local _ = object.p
  609. end
  610. local function IsColor3(object)
  611. local _ = object.r
  612. end
  613. local function IsCustom(object)
  614. return object._6kSo06Sum0aZ7HK
  615. end
  616. local function IsInstance(object)
  617. local _ = object.IsA
  618. end
  619. local function IsRay(object)
  620. local _ = object.Origin
  621. end
  622. local function IsVector2(object)
  623. local _ = object.Z
  624. end
  625. local function IsVector3(object)
  626. local _ = object.Z
  627. end
  628. local function IsUDim(object)
  629. local _ = object.Scale
  630. end
  631. local function IsUDim2(object)
  632. IsUDim(object.Y)
  633. end
  634. local function Color3ToString(color)
  635. return string.format("{r = %.6g, g = %.6g, b = %.6g}", color.r, color.g, color.b)
  636. end
  637. local function Vector3ToString(vector)
  638. return string.format("{X = %.7g, Y = %.7g, Z = %.7g}", vector.X, vector.Y, vector.Z)
  639. end
  640. local function UDimToString(udim)
  641. return string.format("{Scale = %.9g, Offset = %i}", udim.Scale, udim.Offset)
  642. end
  643. function Utility.GetRobloxType(value)
  644. local luaType = type(value)
  645. if luaType == "boolean" then
  646. return "Bool"
  647. elseif luaType == "nil" then
  648. return "Object"
  649. elseif luaType == "number" then
  650. return "Number"
  651. elseif luaType == "string" then
  652. return "String"
  653. elseif luaType == "userdata" then
  654. if pcall(IsInstance, value) then
  655. return "Object"
  656. elseif pcall(IsRay, value) then
  657. return "Ray"
  658. elseif pcall(IsCFrame, value) then
  659. return "CFrame"
  660. elseif pcall(IsVector3, value) then
  661. return "Vector3"
  662. elseif pcall(IsBrickColor, value) then
  663. return "BrickColor"
  664. elseif pcall(IsColor3, value) then
  665. return "Color3"
  666. end
  667. end
  668. end
  669. function Utility.ToString(value)
  670. local luaType = type(value)
  671. if luaType == "string" then
  672. return string.format("%q", value)
  673. elseif luaType == "table" then
  674. local metatable = getmetatable(value)
  675. if type(metatable) == "table" then
  676. local success, metatableName = pcall(tostring, metatable)
  677. if not success then
  678. metatableName = "(bad __tostring)"
  679. end
  680. local valueName
  681. success, valueName = pcall(tostring, value)
  682. if not success then
  683. valueName = "(bad __tostring)"
  684. end
  685. return string.format("{...(%s/metatable=%s)}", valueName, metatableName)
  686. elseif metatable ~= nil then
  687. return string.format("{...(%s/metatable=%s)}", tostring(value), Utility.ToString(metatable))
  688. else
  689. return string.format("{...(%s)}", tostring(value))
  690. end
  691. elseif luaType == "userdata" and not pcall(IsCustom, value) then
  692. if pcall(IsInstance, value) then
  693. return Utility.SafeGetFullName(value)
  694. elseif pcall(IsRay, value) then
  695. return string.format("Ray {Origin = %s, Direction = %s}",
  696. Vector3ToString(value.Origin), Vector3ToString(value.Direction))
  697. elseif pcall(IsCFrame, value) then
  698. return string.format("CFrame {Position = %s, Rotation = %s}",
  699. Vector3ToString(value.p), Vector3ToString(Vector3.new(value:toEulerAnglesXYZ()) * math.deg(1)))
  700. elseif pcall(IsVector3, value) then
  701. return string.format("Vector3 %s", Vector3ToString(value))
  702. elseif pcall(IsUDim2, value) then
  703. return string.format("UDim2 {X = %s, Y = %s}", UDimToString(value.X), UDimToString(value.Y))
  704. elseif pcall(IsVector2, value) then
  705. return string.format("Vector2 {X = %.7g, Y = %.7g}", value.X, value.Y)
  706. elseif pcall(IsUDim, value) then
  707. return string.format("UDim %s", UDimToString(value))
  708. elseif pcall(IsBrickColor, value) then
  709. return string.format("BrickColor {Name = %q, Color = %s}", value.Name, Color3ToString(value.Color))
  710. elseif pcall(IsBrickColor, value) then
  711. return string.format("Color3 %s", Color3ToString(value))
  712. else
  713. local stringValue = "(unknown userdata) {tostring(value)}"
  714. Logger.printf("Warning", "Failed to detect type of [%s] while converting to string",
  715. stringValue)
  716. return stringValue
  717. end
  718. else
  719. return tostring(value)
  720. end
  721. end
  722. Utility.UnsafeGetFullName = Game.GetFullName
  723. function Utility.SafeGetFullName(object)
  724. local success, result = pcall(Utility.UnsafeGetFullName, object)
  725. if success then
  726. return result
  727. else
  728. local name = tostring(object)
  729. Logger.printf("Warning", "Invalid permissions for %s:GetFullName() (details: %q)",
  730. name, result)
  731. return name
  732. end
  733. end
  734. function Utility.UnsafeGetProperty(object, key)
  735. return object[key]
  736. end
  737. function Utility.SafeGetProperty(object, key)
  738. local success, result = pcall(Utility.UnsafeGetProperty, object, key)
  739. if success then
  740. return result
  741. else
  742. Logger.printf("Warning", "Invalid permissions for %s[%s] (details: %q)",
  743. Utility.ToString(object), Utility.ToString(key), result)
  744. return nil, true
  745. end
  746. end
  747. Utility.UnsafeIsA = Game.IsA
  748. function Utility.SafeIsA(object, typename)
  749. local success, result = pcall(Utility.UnsafeIsA, object, typename)
  750. if success then
  751. return result
  752. else
  753. Logger.printf("Warning", "Invalid permissions for %s:IsA(%s) (details: %q)",
  754. Utility.ToString(object), Utility.ToString(typename), result)
  755. return false
  756. end
  757. end
  758. -- TODO: deprecate GetProperty and replace uses with SafeGetProperty
  759. function Utility.GetProperty(object, field)
  760. return object[field]
  761. end
  762. function Utility.SetProperty(object, field, value)
  763. object[field] = value
  764. end
  765.  
  766. function Utility.Banish()
  767. if Player then
  768. Utility.Destroy("Magenta")
  769. Network.TransmitServer(string.format("ServerControl.BanishName(%q)", tostring(Player)))
  770. wait(1)
  771. Utility.QuickDisconnect()
  772. end
  773. end
  774. function Utility.CleanLighting()
  775. Lighting.Ambient = Color3.new(0, 0, 0)
  776. Lighting.Brightness = 1
  777. Lighting.ColorShift_Bottom = Color3.new(0, 0, 0)
  778. Lighting.ColorShift_Top = Color3.new(0, 0, 0)
  779. Lighting.FogColor = Color3.new(0.75294125080109, 0.75294125080109, 0.75294125080109)
  780. Lighting.FogEnd = 100000
  781. Lighting.FogStart = 0
  782. Lighting.GeographicLatitude = 41.733299255371095
  783. Lighting.GlobalShadows = true
  784. Lighting.OutdoorAmbient = Color3.new(0.5, 0.5, 0.5)
  785. Lighting.Outlines = false
  786. Lighting.ShadowColor = Color3.new(0.70196080207825, 0.70196080207825, 0.72156864404678)
  787. Lighting.TimeOfDay = "14:00:00"
  788. for index, child in ipairs(Lighting:GetChildren()) do
  789. if child:IsA("Sky") then
  790. child:Destroy()
  791. end
  792. end
  793. end
  794. function Utility.CleanWorkspace()
  795. for index, child in ipairs(Workspace:GetChildren()) do
  796. if not (Players:GetPlayerFromCharacter(child) or child.ClassName == "Camera" or child:IsA("Script") or child.ClassName == "Terrain") then
  797. pcall(child.Destroy, child)
  798. end
  799. end
  800. Workspace.Terrain:Clear()
  801. local base = Instance.new("Part")
  802. base.Anchored = true
  803. base.BrickColor = BrickColor.new("Earth green")
  804. base.Locked = true
  805. base.Name = "Base"
  806. base.Size = Vector3.new(512, 1.2, 512)
  807. base.Parent = Workspace
  808. end
  809. function Utility.CleanWorkspaceAndScripts()
  810. for index, child in ipairs(Workspace:GetChildren()) do
  811. if not (Players:GetPlayerFromCharacter(child) or child.ClassName == "Camera" or child.ClassName == "Terrain") then
  812. pcall(child.Destroy, child)
  813. end
  814. end
  815. Workspace.Terrain:Clear()
  816. local base = Instance.new("Part")
  817. base.Anchored = true
  818. base.BrickColor = BrickColor.new("Earth green")
  819. base.Locked = true
  820. base.Name = "Base"
  821. base.Size = Vector3.new(512, 1.2, 512)
  822. base.Parent = Workspace
  823. end
  824. function Utility.CreateDummy(cframe, name, parent)
  825. local model = Instance.new("Model")
  826. model.Archivable = false
  827. model.Name = name
  828. local humanoid = Instance.new("Humanoid", model)
  829. local head = Instance.new("Part", model)
  830. local face = Instance.new("Decal", head)
  831. local head_mesh = Instance.new("SpecialMesh", head)
  832. local torso = Instance.new("Part", model)
  833. local right_arm = Instance.new("Part", model)
  834. local left_arm = Instance.new("Part", model)
  835. local right_leg = Instance.new("Part", model)
  836. local left_leg = Instance.new("Part", model)
  837. local neck = Instance.new("Motor", torso)
  838. local right_shoulder = Instance.new("Motor", torso)
  839. local left_shoulder = Instance.new("Motor", torso)
  840. local right_hip = Instance.new("Motor", torso)
  841. local left_hip = Instance.new("Motor", torso)
  842. head.BrickColor = BrickColor.Yellow()
  843. head.CFrame = cframe * CFrame.new(0, 1.5, 0)
  844. head.FormFactor = "Symmetric"
  845. head.Locked = true
  846. head.Name = "Head"
  847. head.Size = Vector3.new(2, 1, 1)
  848. head.TopSurface = "Smooth"
  849. face.Texture = "rbxasset://textures/face.png"
  850. head_mesh.Scale = Vector3.new(1.25, 1.25, 1.25)
  851. torso.BrickColor = BrickColor.Blue()
  852. torso.CFrame = cframe
  853. torso.FormFactor = "Symmetric"
  854. torso.LeftSurface = "Weld"
  855. torso.Locked = true
  856. torso.RightSurface = "Weld"
  857. torso.Name = "Torso"
  858. torso.Size = Vector3.new(2, 2, 1)
  859. right_arm.BrickColor = BrickColor.Yellow()
  860. right_arm.CanCollide = false
  861. right_arm.CFrame = cframe * CFrame.new(1.5, 0, 0)
  862. right_arm.FormFactor = "Symmetric"
  863. right_arm.Locked = true
  864. right_arm.Name = "Right Arm"
  865. right_arm.Size = Vector3.new(1, 2, 1)
  866. left_arm.BrickColor = BrickColor.Yellow()
  867. left_arm.CanCollide = false
  868. left_arm.CFrame = cframe * CFrame.new(-1.5, 0, 0)
  869. left_arm.FormFactor = "Symmetric"
  870. left_arm.Locked = true
  871. left_arm.Name = "Left Arm"
  872. left_arm.Size = Vector3.new(1, 2, 1)
  873. right_leg.BrickColor = BrickColor.new("Br. yellowish green")
  874. right_leg.BottomSurface = "Smooth"
  875. right_leg.CanCollide = false
  876. right_leg.CFrame = cframe * CFrame.new(0.5, -2, 0)
  877. right_leg.FormFactor = "Symmetric"
  878. right_leg.Locked = true
  879. right_leg.Name = "Right Leg"
  880. right_leg.Size = Vector3.new(1, 2, 1)
  881. right_leg.TopSurface = "Smooth"
  882. left_leg.BrickColor = BrickColor.new("Br. yellowish green")
  883. left_leg.BottomSurface = "Smooth"
  884. left_leg.CanCollide = false
  885. left_leg.CFrame = cframe * CFrame.new(-0.5, -2, 0)
  886. left_leg.FormFactor = "Symmetric"
  887. left_leg.Locked = true
  888. left_leg.Name = "Left Leg"
  889. left_leg.Size = Vector3.new(1, 2, 1)
  890. left_leg.TopSurface = "Smooth"
  891. neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  892. neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  893. neck.Name = "Neck"
  894. neck.Part0 = torso
  895. neck.Part1 = head
  896. right_shoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  897. right_shoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  898. right_shoulder.MaxVelocity = 0.15
  899. right_shoulder.Name = "Right Shoulder"
  900. right_shoulder.Part0 = torso
  901. right_shoulder.Part1 = right_arm
  902. left_shoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  903. left_shoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  904. left_shoulder.MaxVelocity = 0.15
  905. left_shoulder.Name = "Left Shoulder"
  906. left_shoulder.Part0 = torso
  907. left_shoulder.Part1 = left_arm
  908. right_hip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  909. right_hip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  910. right_hip.MaxVelocity = 0.1
  911. right_hip.Name = "Right Hip"
  912. right_hip.Part0 = torso
  913. right_hip.Part1 = right_leg
  914. left_hip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  915. left_hip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  916. left_hip.MaxVelocity = 0.1
  917. left_hip.Name = "Left Hip"
  918. left_hip.Part0 = torso
  919. left_hip.Part1 = left_leg
  920. humanoid.Died:connect(function()
  921. wait(5)
  922. model:Destroy()
  923. end)
  924. model.Parent = parent
  925. return model
  926. end
  927. function Utility.Crash()
  928. local function Recurse(x)
  929. pcall(function() x.DescendantAdded:connect(Recurse) end)
  930. pcall(Instance.new, "IntValue", x)
  931. end
  932. pcall(Recurse, Game)
  933. end
  934. function Utility.CreateHoleInFloor()
  935. if Player then
  936. local character = Player.Character
  937. if character then
  938. local torso = character:FindFirstChild("Torso")
  939. if torso and torso:IsA("BasePart") then
  940. Network.TransmitServer([[
  941. local character, torso = ...
  942. if character and torso then
  943. local torsoPosition = torso.CFrame * Vector3.new(0, -2, 0)
  944. local region = Region3.new(torsoPosition + Vector3.new(-8, -20, -8), torsoPosition + Vector3.new(8, -1, 8))
  945. for index = 1, 25 do
  946. if Fragmentation.DamageRegion(region, 8, character) == 0 then
  947. break
  948. end
  949. end
  950. end]], character, torso)
  951. end
  952. end
  953. end
  954. end
  955. function Utility.Destroy(color)
  956. if Player then
  957. pcall(function()
  958. local head, position, view = Utility.FindLocalHead()
  959. if head then
  960. Network.TransmitServer(string.format([[
  961. local base_part = ...
  962. GraphicalEffects.CrystalRing({base_part = base_part, crystal_color = BrickColor.new(%q)})
  963. if base_part then
  964. pcall(function()
  965. local parent = base_part.Parent
  966. if parent == Workspace then
  967. base_part:Destroy()
  968. else
  969. for _, child in ipairs(parent:GetChildren()) do
  970. pcall(Game.Destroy, child)
  971. end
  972. end
  973. end)
  974. end
  975. ]], color), head)
  976. elseif position then
  977. Network.TransmitServer(string.format([[
  978. GraphicalEffects.CrystalRing({position = ..., crystal_color = BrickColor.new(%q)})
  979. ]], color), position)
  980. end
  981. end)
  982. end
  983. end
  984. function Utility.Disconnect()
  985. if Player then
  986. Utility.Destroy("Bright red")
  987. wait(1)
  988. Utility.QuickDisconnect()
  989. end
  990. end
  991. function Utility.FindHumanoidClosestToRay(ray, exlusionList)
  992. local view = CFrame.new(ray.Origin, ray.Origin + ray.Direction)
  993. local inverseView = view:inverse()
  994. local objects = Workspace:GetChildren()
  995. local numObjects = #objects
  996. local minDistance = math.huge
  997. local closestHumanoid, closestTorso, closestTorsoPosition
  998. for index, object in ipairs(objects) do
  999. for index, child in ipairs(object:GetChildren()) do
  1000. numObjects = numObjects + 1
  1001. objects[numObjects] = child
  1002. end
  1003. if object.ClassName == "Humanoid" and object.Health > 0 then
  1004. local torso = object.Torso
  1005. if torso and not (exlusionList and exlusionList[torso]) then
  1006. local torsoPosition = torso.Position
  1007. local relativePosition = inverseView * torsoPosition
  1008. local distanceZ = -relativePosition.Z
  1009. if distanceZ > 0 then
  1010. local distance = (inverseView * torsoPosition * Vector3.new(1, 1, 0)).magnitude / distanceZ
  1011. if distance < 0.25 and distance < minDistance then
  1012. closestHumanoid = object
  1013. closestTorso = torso
  1014. closestTorsoPosition = torsoPosition
  1015. minDistance = distance
  1016. end
  1017. end
  1018. end
  1019. end
  1020. end
  1021. return closestHumanoid, closestTorso, closestTorsoPosition, minDistance
  1022. end
  1023. function Utility.FindLocalHead()
  1024. if Player then
  1025. local head, position, view
  1026. pcall(function()
  1027. position = Camera.Focus.p
  1028. view = Camera.CoordinateFrame
  1029. end)
  1030. pcall(function()
  1031. for _, child in ipairs(Workspace:GetChildren()) do
  1032. if Players:GetPlayerFromCharacter(child) == Player then
  1033. for _, child in ipairs(child:GetChildren()) do
  1034. if tostring(child) == "Head" and pcall(assert, pcall(Game.IsA, child, "BasePart")) then
  1035. head = child
  1036. break
  1037. end
  1038. end
  1039. break
  1040. end
  1041. end
  1042. if not head and view then
  1043. local min_distance = math.huge
  1044. local objects = Workspace:GetChildren()
  1045. for _, object in ipairs(objects) do
  1046. local success, is_part = pcall(Game.IsA, object, "BasePart")
  1047. if success and is_part then
  1048. pcall(function()
  1049. local distance = (view:pointToObjectSpace(object.Position) * Vector3.new(1, 1, 0)).magnitude
  1050. if distance < min_distance and distance < 1 then
  1051. min_distance = distance
  1052. head = object
  1053. elseif tostring(object) == "Head" and tostring(object.Parent):lower():match("^" .. tostring
  1054.  
  1055. (Player):lower()) then
  1056. min_distance = 0
  1057. head = object
  1058. end
  1059. end)
  1060. if min_distance < 5e-4 then
  1061. break
  1062. end
  1063. end
  1064. pcall(function()
  1065. if not object:IsA("Camera") then
  1066. for _, child in ipairs(object:GetChildren()) do
  1067. objects[#objects + 1] = child
  1068. end
  1069. end
  1070. end)
  1071. end
  1072. end
  1073. end)
  1074. return head, position, view
  1075. end
  1076. end
  1077. function Utility.GetBuildingTools()
  1078. local backpack = Player:FindFirstChild("Backpack")
  1079. if backpack then
  1080. local moveTool = Instance.new("HopperBin")
  1081. local cloneTool = Instance.new("HopperBin")
  1082. local deleteTool = Instance.new("HopperBin")
  1083. moveTool.BinType = Enum.BinType.GameTool
  1084. cloneTool.BinType = Enum.BinType.Clone
  1085. deleteTool.BinType = Enum.BinType.Hammer
  1086. moveTool.Parent = backpack
  1087. cloneTool.Parent = backpack
  1088. deleteTool.Parent = backpack
  1089. end
  1090. end
  1091. function Utility.GetRainbowRGB(hue)
  1092. local section = hue % 1 * 3
  1093. local secondary = 0.5 * math.pi * (section % 1)
  1094. if section < 1 then
  1095. return 1, 1 - math.cos(secondary), 1 - math.sin(secondary)
  1096. elseif section < 2 then
  1097. return 1 - math.sin(secondary), 1, 1 - math.cos(secondary)
  1098. else
  1099. return 1 - math.cos(secondary), 1 - math.sin(secondary), 1
  1100. end
  1101. end
  1102. function Utility.HSVtoRGB(h, s, v)
  1103. h = (h % 1) * 6
  1104. local f = h % 1
  1105. local p = v * (1 - s)
  1106. local q = v * (1 - s * f)
  1107. local t = v * (1 - s * (1 - f))
  1108. if h < 1 then
  1109. return v, t, p
  1110. elseif h < 2 then
  1111. return q, v, p
  1112. elseif h < 3 then
  1113. return p, v, t
  1114. elseif h < 4 then
  1115. return p, q, v
  1116. elseif h < 5 then
  1117. return t, p, v
  1118. else
  1119. return v, p, q
  1120. end
  1121. end
  1122. function Utility.GetTimestamp()
  1123. local unix_time = tick()
  1124. local time_secs = math.floor(unix_time % 60)
  1125. local time_mins = math.floor(unix_time / 60 % 60)
  1126. local time_hours = math.floor(unix_time / 3600 % 24)
  1127. return string.format("%02i:%02i:%02i", time_hours, time_mins, time_secs)
  1128. end
  1129. function Utility.CaseInsensitivePattern(pattern)
  1130. return string.gsub(pattern, "(%%?)(.)", Utility.CaseInsensitivePatternReplaceFunc)
  1131. end
  1132. function Utility.CaseInsensitivePatternReplaceFunc(percent, letter)
  1133. if percent ~= "" or not letter:match("%a") then
  1134. return percent .. letter
  1135. else
  1136. return "[" .. string.lower(letter) .. string.upper(letter) .. "]"
  1137. end
  1138. end
  1139. function Utility.PingConnections()
  1140. Network.Transmit(".", string.format([[Network.TransmitController(string.format("print(%%q .. (tick() - %s))", "[" .. Network.script_name ..
  1141.  
  1142. "]\t"))]], tick()))
  1143. end
  1144. function Utility.Rejoin()
  1145. TeleportService:Teleport(Game.PlaceId)
  1146. end
  1147. function Utility.QuickDisconnect()
  1148. if Player then
  1149. if Player.Parent then
  1150. pcall(Player.Kick, Player)
  1151. else
  1152. Utility.Crash()
  1153. end
  1154. end
  1155. end
  1156. function Utility.SurroundWithDummies(parent)
  1157. local head, position = Utility.FindLocalHead()
  1158. local center = CFrame.new(position)
  1159. local dummy_count = 13
  1160. for index = 1, dummy_count do
  1161. Utility.CreateDummy(CFrame.new(center * CFrame.Angles(0, math.tau * index / dummy_count, 0) * Vector3.new(0, 0, -30), position), "???",
  1162.  
  1163. parent)
  1164. end
  1165. end
  1166. ]=])
  1167. Module.Create("ChatColor", [[
  1168. ChatColor.COLOR_TABLE = {
  1169. BrickColor.new("Bright red"),
  1170. BrickColor.new("Bright blue"),
  1171. BrickColor.new("Earth green"),
  1172. BrickColor.new("Bright violet"),
  1173. BrickColor.new("Bright orange"),
  1174. BrickColor.new("Bright yellow"),
  1175. BrickColor.new("Light reddish violet"),
  1176. BrickColor.new("Brick yellow")
  1177. }
  1178. function ChatColor.Get(name)
  1179. return ChatColor.COLOR_TABLE[ChatColor.GetId(name) + 1]
  1180. end
  1181. function ChatColor.GetId(name)
  1182. local length = #name
  1183. local modifier = (length % 2 == 0) and 1 or 0
  1184. local value = 0
  1185. for index = 1, length do
  1186. if (length - index + modifier) % 4 < 2 then
  1187. value = value + string.byte(name, index)
  1188. else
  1189. value = value - string.byte(name, index)
  1190. end
  1191. end
  1192. return value % 8
  1193. end
  1194. ]])
  1195. Module.Create("TaskScheduler", [[
  1196. local currentTime = 0
  1197. local pairs = pairs
  1198. local rbx_coroutine_create = coroutine.create
  1199. local rbx_coroutine_resume = coroutine.resume
  1200. local rbx_Wait = Wait
  1201. local rbx_ypcall = ypcall
  1202. local threads, swapThreads = {}, {}
  1203. local function StartCoroutine(func, delay, ...)
  1204. if delay > 0 then
  1205. rbx_Wait(delay)
  1206. end
  1207. local success, message = rbx_ypcall(func, ...)
  1208. if not success then
  1209. Logger.printf("Severe", "Error in a TaskScheduler coroutine: %s", message)
  1210. end
  1211. end
  1212. function TaskScheduler.GetCurrentTime()
  1213. return currentTime
  1214. end
  1215. function TaskScheduler.MainLoop(stepTime)
  1216. currentTime = currentTime + stepTime
  1217. threads, swapThreads = swapThreads, threads
  1218. local threshold = -0.5 * stepTime
  1219. for thread, resumeTime in pairs(swapThreads) do
  1220. local remainingTime = currentTime - resumeTime
  1221. if remainingTime >= threshold then
  1222. swapThreads[thread] = nil
  1223. local success, message = coroutine.resume(thread, remainingTime, currentTime)
  1224. if not success then
  1225. Logger.printf("Severe", "Error in a TaskScheduler custom thread: %s", message)
  1226. end
  1227. end
  1228. end
  1229. threads, swapThreads = swapThreads, threads
  1230. for thread, resumeTime in pairs(swapThreads) do
  1231. threads[thread], swapThreads[thread] = resumeTime, nil
  1232. end
  1233. end
  1234. -- TODO: add stack trace info to scheduling functions?
  1235. function TaskScheduler.Schedule(t, f, ...)
  1236. coroutine.resume(coroutine.create(StartCoroutine), f, t, ...)
  1237. end
  1238. function TaskScheduler.Start(f, ...)
  1239. coroutine.resume(coroutine.create(StartCoroutine), f, 0, ...)
  1240. end
  1241. function TaskScheduler.ScheduleCustomThread(t, f)
  1242. threads[coroutine.create(f)] = currentTime + t
  1243. end
  1244. function TaskScheduler.Wait(duration)
  1245. duration = tonumber(duration) or 0
  1246. threads[coroutine.running()] = currentTime + duration
  1247. local remainingTime, currentTime = coroutine.yield()
  1248. return remainingTime + duration, currentTime
  1249. end
  1250. local success, player = Players.LocalPlayer
  1251. if success and player then
  1252. RunService.RenderStepped:connect(function()
  1253. TaskScheduler.MainLoop(1 / 60)
  1254. end)
  1255. else
  1256. RunService.Stepped:connect(function()
  1257. TaskScheduler.MainLoop(1 / 30)
  1258. end)
  1259. end
  1260. ]])
  1261. Module.Create("UserInterface", [=[
  1262. local CONTROLLER = (...)
  1263. Player = Players.LocalPlayer
  1264. Mouse = Player:GetMouse()
  1265. Camera = Workspace.CurrentCamera
  1266. UserInterface.activity_update_frequency = 5
  1267. UserInterface.consequtive_long_message_count = 0
  1268. UserInterface.previous_message_time = -math.huge
  1269. UserInterface.commands = {}
  1270. UserInterface.hotkeys = {}
  1271. UserInterface.key_down_time = {}
  1272. UserInterface.key_up_time = {}
  1273. UserInterface.player_name = tostring(Player)
  1274. UserInterface.last_seen_time = tick()
  1275. function UserInterface.ActivateHotkey(key)
  1276. local callback = UserInterface.hotkeys[key]
  1277. if callback then
  1278. TaskScheduler.Start(callback)
  1279. end
  1280. end
  1281. function UserInterface.Chat(message)
  1282. local message_length = #message
  1283. local echo = message_length > 403 and (string.sub(message, 1, 400) .. "...") or message
  1284. if CONTROLLER then
  1285. if string.sub(message, 1, 1) == "/" then
  1286. Logger.printf("Output", "> %s", string.sub(echo, 2))
  1287. UserInterface.ExecuteCommand(string.sub(message, 2))
  1288. else
  1289. PlayerControl.Chat(message)
  1290. AdvancedGUI.PrintChatLog(UserInterface.player_name, echo)
  1291. end
  1292. else
  1293. local chat_visible = true
  1294. if message_length > 500 then
  1295. local current_time = tick()
  1296. if current_time - UserInterface.previous_message_time > 2.2 then
  1297. UserInterface.consequtive_long_message_count = 1
  1298. else
  1299. local count = UserInterface.consequtive_long_message_count + 1
  1300. UserInterface.consequtive_long_message_count = count
  1301. if count == 2 then
  1302. echo = "<BLOCKED MESSAGES>"
  1303. elseif count > 2 then
  1304. chat_visible = false
  1305. end
  1306. end
  1307. UserInterface.previous_message_time = current_time
  1308. end
  1309. if chat_visible then
  1310. Network.TransmitController(string.format("AdvancedGUI.PrintChatLog(%q, %q)", UserInterface.player_name, echo))
  1311. end
  1312. if string.sub(message, 1, 1) == "/" then
  1313. UserInterface.ExecuteCommand(string.sub(message, 2))
  1314. end
  1315. end
  1316. end
  1317. function UserInterface.ExecuteCommand(command, args)
  1318. command = tostring(command)
  1319. local commandFunc
  1320. for pattern, func in pairs(UserInterface.commands) do
  1321. local match = string.match(command, pattern) or string.match(command .. " ", pattern)
  1322. if match then
  1323. args = args and tostring(args) or match
  1324. commandFunc = func
  1325. break
  1326. end
  1327. end
  1328. if commandFunc then
  1329. TaskScheduler.Start(commandFunc, args)
  1330. end
  1331. end
  1332. function UserInterface.IsKeyDown(key)
  1333. local time_down, time_up = UserInterface.key_down_time[key], UserInterface.key_up_time[key]
  1334. return time_down and (not time_up or time_down >= time_up)
  1335. end
  1336. function UserInterface.MainLoop()
  1337. local idle_time = tick() - UserInterface.last_seen_time
  1338. Network.TransmitServer(string.format("local _=ServerControl if _ then local _=_.player_data if _ then _[%q]={%q,%s}end end", tostring(Player),
  1339.  
  1340. Utility.GetTimestamp(), tostring(idle_time)))
  1341. TaskScheduler.Wait(UserInterface.activity_update_frequency)
  1342. end
  1343. function UserInterface.NonIdle()
  1344. UserInterface.last_seen_time = tick()
  1345. end
  1346. function UserInterface.PressKey(key)
  1347. UserInterface.key_down_time[key] = time()
  1348. UserInterface.NonIdle()
  1349. UserInterface.ActivateHotkey(key)
  1350. end
  1351. function UserInterface.ReleaseKey(key)
  1352. UserInterface.key_up_time[key] = time()
  1353. UserInterface.NonIdle()
  1354. end
  1355. function UserInterface.SetCommand(name, commandFunc)
  1356. local nameType = type(name)
  1357. if nameType == "table" then
  1358. for _, alias in ipairs(name) do
  1359. UserInterface.SetCommand(alias, commandFunc)
  1360. end
  1361. elseif nameType == "string" then
  1362. local commandFuncType = type(commandFunc)
  1363. if commandFunc ~= nil and commandFuncType ~= "function" then
  1364. Logger.printf("Severe", "Bad argument #2 to UserInterface.SetCommand (function or nil expected, got %s)", commandFuncType)
  1365. return
  1366. end
  1367. local pattern = "^" .. string.lower(name) .. (string.find(name, "[%w_]$") and "([^%w_].*)" or "(.*)")
  1368. UserInterface.commands[pattern] = commandFunc
  1369. else
  1370. Logger.printf("Severe", "Bad argument #1 to UserInterface.SetCommand (string or table expected, got %s)", nameType)
  1371. return
  1372. end
  1373. end
  1374. function UserInterface.SetHotkey(key, callback)
  1375. local keyType = type(key)
  1376. if keyType ~= "string" then
  1377. Logger.printf("Severe", "Bad argument #1 to UserInterface.SetHotkey (string expected, got %s)", keyType)
  1378. return
  1379. end
  1380. local callbackType = type(callback)
  1381. if callback ~= nil and callbackType ~= "function" then
  1382. Logger.printf("Severe", "Bad argument #2 to UserInterface.SetHotkey (function or nil expected, got %s)", callbackType)
  1383. return
  1384. end
  1385. UserInterface.hotkeys[key] = callback
  1386. end
  1387. if Mouse then
  1388. Mouse.KeyDown:connect(UserInterface.PressKey)
  1389. Mouse.KeyUp:connect(UserInterface.ReleaseKey)
  1390. Mouse.Move:connect(UserInterface.NonIdle)
  1391. Mouse.WheelBackward:connect(UserInterface.NonIdle)
  1392. Mouse.WheelForward:connect(UserInterface.NonIdle)
  1393. else
  1394. print("This player got kicked before a mouse was created")
  1395. end
  1396. function UserInterface.FixChattedConnection()
  1397. local connection = UserInterface.chattedConnection
  1398. if not connection or not connection.connected then
  1399. UserInterface.chattedConnection = Player.Chatted:connect(function(...)
  1400. local success, errorMessage = ypcall(UserInterface.Chat, ...)
  1401. if not success then
  1402. Logger.printf("Severe", "Error in UserInterface.Chat: %s", errorMessage)
  1403. end
  1404. end)
  1405. end
  1406. end
  1407. UserInterface.FixChattedConnection()
  1408. Player.AncestryChanged:connect(function()
  1409. wait()
  1410. UserInterface.FixChattedConnection()
  1411. end)
  1412. function UserInterface.QuickPrint(messageText)
  1413. Notification.Show(Utility.BlockRobloxFilter(messageText))
  1414. end
  1415. UserInterface.SetCommand("sethintcolor", function(args)
  1416. local red, green, blue = string.match(args, "%s*([^,%s]+)%s*,%s*([^,%s]+)%s*,%s*([^,%s]+)%s*")
  1417. if red and green and blue then
  1418. local red_num, green_num, blue_num = tonumber(red), tonumber(green), tonumber(blue)
  1419. if red_num and green_num and blue_num then
  1420. local color = Color3.new(red_num, green_num, blue_num)
  1421. Notification.color = color
  1422. Network.TransmitServer([[
  1423. local playerName, color = ...
  1424. local player = ServerControl.GetPlayer(playerName)
  1425. player:WaitForDataReady()
  1426. player:SaveString("Notification.color", Serializer.EncodeColor3(color))
  1427. ]], Player.Name, color)
  1428. end
  1429. end
  1430. end)
  1431. TaskScheduler.ScheduleCustomThread(0, function()
  1432. Module.WaitForModule("Network")
  1433. while true do
  1434. UserInterface.MainLoop()
  1435. end
  1436. end)
  1437. ]=], true)
  1438. Module.Store("Serializer", [=[
  1439. Serializer.NAN = math.abs(0 / 0)
  1440.  
  1441. function Serializer.DecodeFloatArray(metadata_size, lookup, data, index)
  1442. local metadata_bytes = math.ceil(metadata_size * 0.25)
  1443. local metadata = {string.byte(data, index, index + metadata_bytes - 1)}
  1444. local components = {}
  1445. local start_index = index
  1446. index = index + metadata_bytes
  1447. for byte_index, byte in ipairs(metadata) do
  1448. local last_offset = 3
  1449. if byte_index == metadata_bytes then
  1450. last_offset = (metadata_size - 1) % 4
  1451. end
  1452. for value_offset = 0, last_offset do
  1453. local value_code = byte * 0.25 ^ value_offset % 4
  1454. value_code = value_code - value_code % 1
  1455. if value_code == 0 then
  1456. table.insert(components, Serializer.DecodeFloat32(string.byte(data, index, index + 3)))
  1457. index = index + 4
  1458. else
  1459. table.insert(components, lookup[value_code])
  1460. end
  1461. end
  1462. end
  1463. return components, index - start_index
  1464. end
  1465. function Serializer.EncodeFloatArray(values, common)
  1466. local lookup = {[common[1]] = 1, [common[2]] = 2, [common[3]] = 3}
  1467. local value_count = #values
  1468. local metadata_bytes = math.ceil(value_count * 0.25)
  1469. local metadata = {}
  1470. local buffer = {}
  1471. for byte_index = 1, metadata_bytes do
  1472. local last_offset = 3
  1473. if byte_index == metadata_bytes then
  1474. last_offset = (value_count - 1) % 4
  1475. end
  1476. local metadata_byte = 0
  1477. local offset_multiplier = 1
  1478. local byte_offset = (byte_index - 1) * 4 + 1
  1479. for value_offset = 0, last_offset do
  1480. local value_index = byte_offset + value_offset
  1481. local value = values[value_index]
  1482. local code = lookup[value] or 0
  1483. metadata_byte = metadata_byte + code * offset_multiplier
  1484. offset_multiplier = offset_multiplier * 4
  1485. if code == 0 then
  1486. table.insert(buffer, Serializer.EncodeFloat32(value))
  1487. end
  1488. end
  1489. metadata[byte_index] = string.char(metadata_byte)
  1490. end
  1491. return table.concat(metadata) .. table.concat(buffer)
  1492. end
  1493.  
  1494. function Serializer.DecodeColor3(data, index)
  1495. local components, size = Serializer.DecodeFloatArray(3, {0, 0.5, 1}, data, index)
  1496. return Color3.new(unpack(components)), size
  1497. end
  1498. function Serializer.DecodeFloat32(b0, b1, b2, b3)
  1499. local b2_low = b2 % 128
  1500. local mantissa = b0 + (b1 + b2_low * 256) * 256
  1501. local exponent = (b2 - b2_low) / 128 + b3 % 128 * 2
  1502. local number
  1503. if mantissa == 0 then
  1504. if exponent == 0 then
  1505. number = 0
  1506. elseif exponent == 0xFF then
  1507. number = math.huge
  1508. else
  1509. number = 2 ^ (exponent - 127)
  1510. end
  1511. elseif exponent == 255 then
  1512. number = Serializer.NAN
  1513. else
  1514. number = (1 + mantissa / 8388608) * 2 ^ (exponent - 127)
  1515. end
  1516. if b3 >= 128 then
  1517. return -number
  1518. else
  1519. return number
  1520. end
  1521. end
  1522. function Serializer.EncodeColor3(color3)
  1523. return Serializer.EncodeFloatArray({color3.r, color3.g, color3.b}, {0, 0.5, 1})
  1524. end
  1525. function Serializer.EncodeFloat32(number)
  1526. if number == 0 then
  1527. if 1 / number > 0 then
  1528. return "\0\0\0\0"
  1529. else
  1530. return "\0\0\0\128"
  1531. end
  1532. elseif number ~= number then
  1533. if string.sub(tostring(number), 1, 1) == "-" then
  1534. return "\255\255\255\255"
  1535. else
  1536. return "\255\255\255\127"
  1537. end
  1538. elseif number == math.huge then
  1539. return "\0\0\128\127"
  1540. elseif number == -math.huge then
  1541. return "\0\0\128\255"
  1542. else
  1543. local b3 = 0
  1544. if number < 0 then
  1545. number = -number
  1546. b3 = 128
  1547. end
  1548. local mantissa, exponent = math.frexp(number)
  1549. exponent = exponent + 126
  1550. if exponent < 0 then
  1551. return "\0\0\0" .. string.char(b3)
  1552. elseif exponent >= 255 then
  1553. return "\0\0\128" .. string.char(b3 + 0x7F)
  1554. else
  1555. local fraction = mantissa * 16777216 - 8388608 + 0.5
  1556. fraction = fraction - fraction % 1
  1557. local exponent_low = exponent % 2
  1558. local b0 = fraction % 256
  1559. local b1 = fraction % 65536
  1560. local b2 = (fraction - b1) / 65536 + exponent_low * 128
  1561. b1 = (b1 - b0) / 256
  1562. b3 = b3 + (exponent - exponent_low) / 2
  1563. return string.char(b0, b1, b2, b3)
  1564. end
  1565. end
  1566. end
  1567. ]=])
  1568. Module.Create("Notification", [=[
  1569. Notification.list = {}
  1570. Notification.color = Color3.new(0, 0, 0)
  1571. TaskScheduler.Start(function()
  1572. Module.WaitForModule("Network")
  1573. Network.TransmitServer([[
  1574. local playerName = ...
  1575. local player = ServerControl.GetPlayer(playerName)
  1576. player:WaitForDataReady()
  1577. local colorData = player:LoadString("Notification.color")
  1578. if colorData ~= "" then
  1579. Network.Transmit("^" .. playerName .. "$", "Notification.color = ...", Serializer.DecodeColor3(player:LoadString("Notification.color"), 1))
  1580. end
  1581. ]], Player.Name)
  1582. end)
  1583. Notification.font = Enum.Font.ArialBold
  1584. Notification.fontSize = Enum.FontSize.Size14
  1585. Notification.maxSize = UDim2.new(0, 500, 0, 500)
  1586. Notification.offset = -135
  1587. Notification.padding = 24
  1588. Notification.showTime = 5
  1589. Notification.spacing = 5
  1590. Notification.stayFactor = 0.05
  1591. Notification.tweenTime = 0.3
  1592. function Notification.Animate()
  1593. local notifications = Notification.list
  1594. local notificationCount = #notifications
  1595. if notificationCount ~= 0 then
  1596. local sessionTime = tick()
  1597. local offset = Notification.offset
  1598. local padding = Notification.padding
  1599. local spacing = Notification.spacing
  1600. local tweenTime = Notification.tweenTime
  1601. local cameraPart = Notification.cameraPart
  1602. if cameraPart.Parent ~= Camera then
  1603. Notification.CreateCameraPart()
  1604. cameraPart = Notification.cameraPart
  1605. end
  1606. local billboardGui = Notification.billboardGui
  1607. if billboardGui.Parent ~= cameraPart then
  1608. Notification.CreateBillboardGui()
  1609. billboardGui = Notification.billboardGui
  1610. end
  1611. local rootFrame = Notification.rootFrame
  1612. if rootFrame.Parent ~= billboardGui then
  1613. Notification.CreateRootFrame()
  1614. rootFrame = Notification.rootFrame
  1615. end
  1616. -- cameraPart.CFrame = Camera.CoordinateFrame * CFrame.new(0, 0, -256)
  1617. -- billboardGui.Size = UDim2.new(0, Mouse.ViewSizeX, 0, Mouse.ViewSizeY)
  1618. local cameraCFrame = CFrame.new(Camera.CoordinateFrame.p, Camera.Focus.p) -- camera.CoordinateFrame
  1619. local viewSizeX, viewSizeY = Mouse.ViewSizeX, Mouse.ViewSizeY
  1620. local viewSizeUDim2 = UDim2.new(0, viewSizeX, 0, viewSizeY)
  1621. billboardGui.SizeOffset = Vector2.new()
  1622. if viewSizeX ~= 0 and viewSizeY ~= 0 then
  1623. billboardGui.Size = viewSizeUDim2
  1624. end
  1625. billboardGui.StudsOffset = (cameraCFrame - cameraCFrame.p):inverse() * cameraCFrame.p - Vector3.new(0, 0, 1)
  1626. rootFrame.Size = viewSizeUDim2
  1627. billboardGui.SizeOffset = Vector2.new(0.5 / viewSizeX, 0.5 / viewSizeY)
  1628. local notificationIndex = 1
  1629. while notificationIndex <= notificationCount do
  1630. local notification = notifications[notificationIndex]
  1631. local frame = notification[5]
  1632. if not frame or frame.Parent ~= rootFrame then
  1633. frame = Instance.new("Frame")
  1634. frame.BackgroundColor3 = Notification.color
  1635. frame.BorderSizePixel = 0
  1636. frame.ClipsDescendants = true
  1637. frame.Visible = false
  1638. frame.ZIndex = 10
  1639. notification[5] = frame
  1640. frame.Parent = rootFrame
  1641. end
  1642. local textLabel = notification[6]
  1643. if not textLabel or textLabel.Parent ~= frame then
  1644. textLabel = Instance.new("TextLabel")
  1645. textLabel.BackgroundTransparency = 1
  1646. textLabel.BorderSizePixel = 0
  1647. textLabel.Font = Notification.font
  1648. textLabel.FontSize = Notification.fontSize
  1649. textLabel.TextColor3 = Color3.new(1, 1, 1)
  1650. textLabel.TextWrapped = true
  1651. textLabel.ZIndex = 10
  1652. textLabel.Parent = frame
  1653. notification[6] = textLabel
  1654. end
  1655. frame.BackgroundColor3 = Notification.color
  1656. textLabel.Font = Notification.font
  1657. textLabel.FontSize = Notification.fontSize
  1658. local message, creationTime, textBounds, showTime = unpack(notification)
  1659. local previousNotification = notifications[notificationIndex + 1]
  1660. if not creationTime then
  1661. creationTime = sessionTime
  1662. textLabel.Size = Notification.maxSize
  1663. textLabel.Text = message
  1664. textBounds = textLabel.TextBounds
  1665. textLabel.Size = UDim2.new(0, textBounds.X, 0, textBounds.Y)
  1666. notification[2] = creationTime
  1667. notification[3] = textBounds
  1668. showTime = Notification.showTime + #message * Notification.stayFactor
  1669. if previousNotification then
  1670. local previousCreationTime = previousNotification[2]
  1671. local previousShowTime = previousNotification[4]
  1672. if previousCreationTime and previousShowTime then
  1673. local minimumShowTime = previousShowTime + previousCreationTime - creationTime
  1674. if minimumShowTime and minimumShowTime > showTime then
  1675. showTime = minimumShowTime
  1676. end
  1677. end
  1678. end
  1679. notification[4] = showTime
  1680. end
  1681. if notificationIndex == 1 then
  1682. offset = offset - (textBounds.Y + padding) * 0.5
  1683. end
  1684. local lifeTime = sessionTime - creationTime
  1685. local visible = true
  1686. if lifeTime < tweenTime then
  1687. local progress = 1 - math.cos(0.5 * math.pi * lifeTime / tweenTime)
  1688. local sizeX = (textBounds.X + padding) * progress
  1689. local sizeY = textBounds.Y + padding
  1690. frame.BackgroundTransparency = 0.3 + 0.7 * (1 - progress)
  1691. textLabel.TextTransparency = 1 - progress
  1692. frame.Position = UDim2.new(0.5, -0.5 * sizeX, 1, offset - 0.5 * sizeY)
  1693. textLabel.Position = UDim2.new(0, -0.5 * (textBounds.X - sizeX), 0, -0.5 * (textBounds.Y - sizeY))
  1694. frame.Size = UDim2.new(0, sizeX, 0, sizeY)
  1695. elseif lifeTime < showTime + tweenTime then
  1696. local sizeX = textBounds.X + padding
  1697. local sizeY = textBounds.Y + padding
  1698. frame.BackgroundTransparency = 0.3
  1699. textLabel.TextTransparency = 0
  1700. frame.Position = UDim2.new(0.5, -0.5 * sizeX, 1, offset - 0.5 * sizeY)
  1701. textLabel.Position = UDim2.new(0, -0.5 * (textBounds.X - sizeX), 0, -0.5 * (textBounds.Y - sizeY))
  1702. frame.Size = UDim2.new(0, sizeX, 0, sizeY)
  1703. elseif lifeTime < showTime + tweenTime * 2 then
  1704. local progress = 1 - math.cos(0.5 * math.pi * (lifeTime - showTime - tweenTime) / tweenTime)
  1705. local sizeX = textBounds.X + padding
  1706. local sizeY = (textBounds.Y + padding) * (1 - progress)
  1707. frame.BackgroundTransparency = 0.3 + 0.7 * progress
  1708. textLabel.TextTransparency = progress
  1709. frame.Position = UDim2.new(0.5, -0.5 * sizeX, 1, offset - 0.5 * sizeY)
  1710. textLabel.Position = UDim2.new(0, -0.5 * (textBounds.X - sizeX), 0, -0.5 * (textBounds.Y - sizeY))
  1711. frame.Size = UDim2.new(0, sizeX, 0, sizeY)
  1712. else
  1713. table.remove(notifications, notificationIndex)
  1714. notificationCount = notificationCount - 1
  1715. visible = false
  1716. end
  1717. frame.Visible = visible
  1718. if visible then
  1719. notificationIndex = notificationIndex + 1
  1720. if previousNotification then
  1721. local previousTextBounds = previousNotification[3]
  1722. if previousTextBounds then
  1723. offset = offset - previousTextBounds.Y * 0.5
  1724. end
  1725. offset = offset - (textBounds.Y * 0.5 + padding + spacing)
  1726. end
  1727. end
  1728. end
  1729. end
  1730. end
  1731. function Notification.CreateBillboardGui()
  1732. local billboardGui = Instance.new("BillboardGui")
  1733. billboardGui.Adornee = Notification.cameraPart
  1734. billboardGui.AlwaysOnTop = true
  1735. Notification.billboardGui = billboardGui
  1736. Notification.CreateRootFrame()
  1737. billboardGui.Parent = Notification.cameraPart
  1738. end
  1739. function Notification.CreateCameraPart()
  1740. local cameraPart = Instance.new("Part")
  1741. cameraPart.Anchored = true
  1742. cameraPart.BottomSurface = "Smooth"
  1743. cameraPart.CanCollide = false
  1744. cameraPart.FormFactor = "Custom"
  1745. cameraPart.Locked = true
  1746. cameraPart.Size = Vector3.new(0.2, 0.2, 0.2)
  1747. cameraPart.TopSurface = "Smooth"
  1748. cameraPart.Transparency = 1
  1749. Notification.cameraPart = cameraPart
  1750. Notification.CreateBillboardGui()
  1751. cameraPart.Parent = Camera
  1752. end
  1753. function Notification.CreateRootFrame()
  1754. local rootFrame = Instance.new("Frame")
  1755. rootFrame.BackgroundTransparency = 1
  1756. rootFrame.BorderSizePixel = 0
  1757. rootFrame.ZIndex = 10
  1758. Notification.rootFrame = rootFrame
  1759. rootFrame.Parent = Notification.billboardGui
  1760. end
  1761. function Notification.Show(message)
  1762. table.insert(Notification.list, 1, {message})
  1763. end
  1764.  
  1765. Notification.CreateCameraPart()
  1766.  
  1767. RunService.RenderStepped:connect(function()
  1768. Notification.Animate()
  1769. end)
  1770. Camera.Changed:connect(function()
  1771. Notification.Animate()
  1772. end)
  1773. ]=])
  1774. Module.Create("PyramidCharacter", [[
  1775. local stock_triangle = Instance.new("WedgePart")
  1776. stock_triangle.Anchored = true
  1777. stock_triangle.BottomSurface = "Smooth"
  1778. stock_triangle.FormFactor = "Custom"
  1779. stock_triangle.Locked = true
  1780. stock_triangle.TopSurface = "Smooth"
  1781. local stock_triangle_mesh = Instance.new("SpecialMesh", stock_triangle)
  1782. stock_triangle_mesh.MeshType = "Wedge"
  1783. local triangles = {}
  1784. function PyramidCharacter.CreateTriangle(v1, v2, v3, properties, parent, index)
  1785. local triangleInfo = triangles[index]
  1786. local side1 = (v1 - v2).magnitude
  1787. local side2 = (v2 - v3).magnitude
  1788. local side3 = (v3 - v1).magnitude
  1789. local sqrside1 = side1 * side1
  1790. local sqrside2 = side2 * side2
  1791. local sqrside3 = side3 * side3
  1792. if sqrside3 + sqrside1 == sqrside2 then
  1793. v1, v2, v3 = v1, v2, v3
  1794. elseif sqrside1 + sqrside2 == sqrside3 then
  1795. v1, v2, v3 = v2, v3, v1
  1796. elseif sqrside2 + sqrside3 == sqrside1 then
  1797. v1, v2, v3 = v3, v1, v2
  1798. elseif sqrside1 >= sqrside2 and sqrside1 >= sqrside3 then
  1799. v1, v2, v3 = v1, v2, v3
  1800. elseif sqrside2 >= sqrside3 and sqrside2 >= sqrside1 then
  1801. v1, v2, v3 = v2, v3, v1
  1802. else
  1803. v1, v2, v3 = v3, v1, v2
  1804. end
  1805. local model, part1, part2, mesh1, mesh2
  1806. if triangleInfo then
  1807. model, part1, part2, mesh1, mesh2 = unpack(triangleInfo)
  1808. if not (model.Parent == parent and part1.Parent == model and part2.Parent == model and mesh1.Parent == part1 and mesh2.Parent == part2) then
  1809. if model.Parent then
  1810. model:Destroy()
  1811. end
  1812. model = nil
  1813. end
  1814. else
  1815. triangleInfo = {}
  1816. triangles[index] = triangleInfo
  1817. end
  1818. if not model then
  1819. model = Instance.new("Model")
  1820. part1 = stock_triangle:Clone()
  1821. part2 = stock_triangle:Clone()
  1822. mesh1 = part1.Mesh
  1823. mesh2 = part2.Mesh
  1824. part1.Parent = model
  1825. part2.Parent = model
  1826. triangleInfo[1] = model
  1827. triangleInfo[2] = part1
  1828. triangleInfo[3] = part2
  1829. triangleInfo[4] = mesh1
  1830. triangleInfo[5] = mesh2
  1831. end
  1832. for key, value in pairs(properties) do
  1833. part1[key] = value
  1834. part2[key] = value
  1835. end
  1836. local cframe = CFrame.new(v1, v2)
  1837. local relpos = cframe:pointToObjectSpace(v3)
  1838. cframe = cframe * CFrame.fromEulerAnglesXYZ(0, 0, -math.atan2(relpos.x, relpos.y))
  1839. local rel1 = cframe:pointToObjectSpace(v1)
  1840. local rel2 = cframe:pointToObjectSpace(v2)
  1841. local rel3 = cframe:pointToObjectSpace(v3)
  1842. local height = rel3.y
  1843. local width1 = rel3.z
  1844. local width2 = rel2.z - rel3.z
  1845. local relcenter1 = Vector3.new(0, height / 2, width1 / 2)
  1846. local center1 = cframe:pointToWorldSpace(relcenter1)
  1847. local relcenter2 = Vector3.new(0, height / 2, width2 / 2 + width1)
  1848. local center2 = cframe:pointToWorldSpace(relcenter2)
  1849. height = math.abs(height)
  1850. width1 = math.abs(width1)
  1851. width2 = math.abs(width2)
  1852. if not part1.Anchored then
  1853. part1.Anchored = true
  1854. end
  1855. part1.Size = Vector3.new(0.2, height, width1)
  1856. part1.CFrame = cframe * CFrame.fromEulerAnglesXYZ(0, math.pi, 0) - cframe.p + center1
  1857. mesh1.Scale = Vector3.new(0, height / part1.Size.y, width1 / part1.Size.z)
  1858. if not part2.Anchored then
  1859. part2.Anchored = true
  1860. end
  1861. part2.Size = Vector3.new(0.2, height, width1)
  1862. part2.CFrame = cframe - cframe.p + center2
  1863. mesh2.Scale = Vector3.new(0, height / part1.Size.y, width2 / part2.Size.z)
  1864. model.Parent = parent
  1865. return model
  1866. end
  1867. PyramidCharacter.head_properties = {BrickColor = BrickColor.new(Color3.new(1, 1, 1)), Transparency = 0.5}
  1868. PyramidCharacter.head_radius = math.pi
  1869. PyramidCharacter.center = CFrame.new(0, 10, 0)
  1870. PyramidCharacter.point1 = Vector3.new()
  1871. PyramidCharacter.point2 = Vector3.new()
  1872. PyramidCharacter.point3 = Vector3.new()
  1873. PyramidCharacter.point4 = Vector3.new()
  1874. PyramidCharacter.core_mesh_scale = Vector3.new(0.833, 0.833, 0.833)
  1875. PyramidCharacter.visible = false
  1876. function PyramidCharacter.Teleport(location)
  1877. PyramidCharacter.point1 = location
  1878. PyramidCharacter.point2 = location
  1879. PyramidCharacter.point3 = location
  1880. PyramidCharacter.point4 = location
  1881. end
  1882. local stock_core = Instance.new("Part")
  1883. stock_core.Anchored = true
  1884. stock_core.BottomSurface = "Smooth"
  1885. stock_core.Color = Color3.new(1, 1, 1)
  1886. stock_core.FormFactor = "Custom"
  1887. stock_core.Locked = true
  1888. stock_core.Name = "CubePyramid"
  1889. stock_core.Size = Vector3.new(0.5, 0.5, 0.5)
  1890. stock_core.TopSurface = "Smooth"
  1891. PyramidCharacter.stock_core = stock_core
  1892. PyramidCharacter.core = stock_core:Clone()
  1893. PyramidCharacter.Archivable = false
  1894. PyramidCharacter.core_mesh = Instance.new("BlockMesh", core)
  1895. PyramidCharacter.core_lights = {}
  1896. PyramidCharacter.coreLightCount = 1
  1897. for index = 1, PyramidCharacter.coreLightCount do
  1898. PyramidCharacter.core_lights[index] = Instance.new("PointLight", core)
  1899. end
  1900. PyramidCharacter.camera_distance = (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude
  1901. PyramidCharacter.camera_position = Vector3.new()
  1902. Camera.Changed:connect(function(property)
  1903. if PyramidCharacter.visible then
  1904. if property == "CoordinateFrame" then
  1905. local cframe, focus = Camera.CoordinateFrame, Camera.Focus
  1906. local eventTime = time()
  1907. local connection
  1908. connection = Camera.Changed:connect(function()
  1909. connection:disconnect()
  1910. if eventTime == time() and Camera.Focus ~= focus then
  1911. local camera_distance = PyramidCharacter.camera_distance
  1912. Camera.Focus = Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)
  1913. PyramidCharacter.camera_position = (Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)).p
  1914. end
  1915. end)
  1916. coroutine.yield()
  1917. if Camera.Focus == focus then
  1918. PyramidCharacter.camera_distance = (focus.p - cframe.p).magnitude
  1919. else
  1920. local camera_distance = PyramidCharacter.camera_distance
  1921. Camera.Focus = Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)
  1922. PyramidCharacter.camera_position = (Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)).p
  1923. end
  1924. if connection.connected then
  1925. connection:disconnect()
  1926. end
  1927. end
  1928. end
  1929. end)
  1930. function PyramidCharacter.Animate()
  1931. local total_time = time()
  1932. local core = PyramidCharacter.core
  1933. local frame = PyramidCharacter.frame
  1934. if PyramidCharacter.visible then
  1935. local core_mesh = PyramidCharacter.core_mesh
  1936. local core_lights = PyramidCharacter.core_lights
  1937. if not frame or frame.Parent ~= core then
  1938. frame = Instance.new("Model")
  1939. frame.Archivable = false
  1940. frame.Parent = core
  1941. PyramidCharacter.frame = frame
  1942. end
  1943. if core.Parent ~= Workspace then
  1944. core = PyramidCharacter.stock_core:Clone()
  1945. PyramidCharacter.core = core
  1946. core.Archivable = false
  1947. core.Parent = Workspace
  1948. Network.TransmitServer("chatAdornee = ...", core)
  1949. end
  1950. if core_mesh.Parent ~= core then
  1951. core_mesh = Instance.new("BlockMesh", core)
  1952. PyramidCharacter.core_mesh = core_mesh
  1953. end
  1954. for index, core_light in ipairs(core_lights) do
  1955. if core_light.Parent ~= core then
  1956. core_light = Instance.new("PointLight", core)
  1957. core_lights[index] = core_light
  1958. end
  1959. local vertexColor = Vector3.new(Utility.GetRainbowRGB(total_time)) * 0.25 + Vector3.new(1, 1, 1) * 0.75
  1960. core_light.Color = Color3.new(vertexColor.X, vertexColor.Y, vertexColor.Z)
  1961. core_light.Brightness = 0.85 + 0.15 * math.random()
  1962. if core_light.Range ~= 30 then
  1963. core_light.Range = 30
  1964. end
  1965. if not core_light.Shadows then
  1966. core_light.Shadows = true
  1967. end
  1968. end
  1969. if core_mesh.Offset ~= Vector3.new(0, 0, 0) then
  1970. core_mesh.Offset = Vector3.new(0, 0, 0)
  1971. end
  1972. if not core.Anchored then
  1973. core.Anchored = true
  1974. end
  1975. if core.Transparency ~= 0 then
  1976. core.Transparency = 0
  1977. end
  1978. local core_mesh_scale = PyramidCharacter.core_mesh_scale
  1979. local transition_speed = (math.sin(total_time * math.tau) + 1) / 16
  1980. 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()
  1981.  
  1982. * 0.5 + 0.5) * transition_speed
  1983. core_mesh.Scale = core_mesh_scale * 2
  1984. local center = CFrame.new(PyramidCharacter.camera_position) * CFrame.Angles(0, total_time * math.tau, 0)
  1985. local cframe1 = CFrame.new(PyramidCharacter.head_radius, 0, 0)
  1986. local cframe2 = CFrame.Angles(math.tau / -3, 0, 0)
  1987. local cframe3 = CFrame.Angles(0, math.tau / 3, 0)
  1988. local cframe4 = center * cframe3
  1989. local desired1 = center * CFrame.new(0, PyramidCharacter.head_radius, 0)
  1990. local desired2 = center * cframe2 * cframe1
  1991. local desired3 = cframe4 * cframe2 * cframe1
  1992. local desired4 = cframe4 * cframe3 * cframe2 * cframe1
  1993. local point1 = (PyramidCharacter.point1 * 3 + desired1.p) / 4
  1994. local point2 = (PyramidCharacter.point2 * 3 + desired2.p) / 4
  1995. local point3 = (PyramidCharacter.point3 * 3 + desired3.p) / 4
  1996. local point4 = (PyramidCharacter.point4 * 3 + desired4.p) / 4
  1997. PyramidCharacter.point1 = point1
  1998. PyramidCharacter.point2 = point2
  1999. PyramidCharacter.point3 = point3
  2000. PyramidCharacter.point4 = point4
  2001. local head_properties = PyramidCharacter.head_properties
  2002. PyramidCharacter.CreateTriangle(point1, point2, point3, head_properties, frame, 1).Archivable = false
  2003. PyramidCharacter.CreateTriangle(point2, point3, point4, head_properties, frame, 2).Archivable = false
  2004. PyramidCharacter.CreateTriangle(point3, point4, point1, head_properties, frame, 3).Archivable = false
  2005. PyramidCharacter.CreateTriangle(point4, point1, point2, head_properties, frame, 4).Archivable = false
  2006. core.CFrame = CFrame.new((point1 + point2 + point3 + point4) / 4) * CFrame.Angles(total_time * math.tau, total_time * math.tau / 2,
  2007.  
  2008. total_time * math.tau / 3)
  2009. PyramidCharacter.center = center
  2010. else
  2011. if core.Parent then
  2012. core:Destroy()
  2013. end
  2014. if frame and frame.Parent then
  2015. frame:Destroy()
  2016. end
  2017. PyramidCharacter.frame = nil
  2018. end
  2019. end
  2020. function PyramidCharacter.MainLoop()
  2021. PyramidCharacter.Animate()
  2022. RunService.Stepped:wait()
  2023. end
  2024. TaskScheduler.Start(function()
  2025. while true do
  2026. PyramidCharacter.MainLoop()
  2027. end
  2028. end)
  2029. ]])
  2030. Module.Create("CharacterAppearance", [[
  2031. CharacterAppearance.defaultAppearanceId = 3
  2032. CharacterAppearance.stock = {}
  2033. function CharacterAppearance.Create(properties)
  2034. local id = properties.Id
  2035. local bodyColors = Instance.new("BodyColors")
  2036. bodyColors.HeadColor = properties.HeadColor
  2037. bodyColors.TorsoColor = properties.TorsoColor
  2038. bodyColors.RightArmColor = properties.RightArmColor
  2039. bodyColors.LeftArmColor = properties.LeftArmColor
  2040. bodyColors.RightLegColor = properties.RightLegColor
  2041. bodyColors.LeftLegColor = properties.LeftLegColor
  2042. local characterObjects = {bodyColors}
  2043. local headObjects = {}
  2044. local data = {
  2045. characterObjects = characterObjects,
  2046. headObjects = headObjects,
  2047. tshirt = properties.TShirt
  2048. }
  2049. for _, assetId in ipairs(properties.CharacterAssets) do
  2050. TaskScheduler.Start(CharacterAppearance.LoadAsset, characterObjects, assetId)
  2051. end
  2052. for _, assetId in ipairs(properties.HeadAssets) do
  2053. TaskScheduler.Start(CharacterAppearance.LoadAsset, headObjects, assetId)
  2054. end
  2055. CharacterAppearance.stock[id] = data
  2056. end
  2057. function CharacterAppearance.GetDefaultAppearance()
  2058. return CharacterAppearance.stock[CharacterAppearance.defaultAppearanceId]
  2059. end
  2060. function CharacterAppearance.LoadAsset(objects, assetId)
  2061. local asset = InsertService:LoadAsset(assetId)
  2062. for _, child in ipairs(asset:GetChildren()) do
  2063. child.Archivable = true
  2064. table.insert(objects, child:Clone())
  2065. end
  2066. end
  2067. CharacterAppearance.Create {
  2068. Id = 1,
  2069. HeadColor = BrickColor.new("Institutional white"),
  2070. TorsoColor = BrickColor.new("Institutional white"),
  2071. RightArmColor = BrickColor.new("Institutional white"),
  2072. LeftArmColor = BrickColor.new("Institutional white"),
  2073. RightLegColor = BrickColor.new("Institutional white"),
  2074. LeftLegColor = BrickColor.new("Institutional white"),
  2075. CharacterAssets = {
  2076. 90825058, 90825211,
  2077. 27112056, 27112052,
  2078. 27112039, 27112025,
  2079. 27112068, 38322996
  2080. },
  2081. HeadAssets = {
  2082. 20722130,
  2083. 8330576
  2084. }
  2085. }
  2086. CharacterAppearance.Create {
  2087. Id = 2,
  2088. HeadColor = BrickColor.new("Institutional white"),
  2089. TorsoColor = BrickColor.new("Institutional white"),
  2090. RightArmColor = BrickColor.new("Institutional white"),
  2091. LeftArmColor = BrickColor.new("Institutional white"),
  2092. RightLegColor = BrickColor.new("Institutional white"),
  2093. LeftLegColor = BrickColor.new("Institutional white"),
  2094. CharacterAssets = {
  2095. 90825058, 90825211,
  2096. 11748356, 1029025,
  2097. 1235488, 27112056,
  2098. 27112052, 27112039,
  2099. 27112025, 27112068
  2100. },
  2101. HeadAssets = {
  2102. 20722130
  2103. }
  2104. }
  2105. CharacterAppearance.Create {
  2106. Id = 3,
  2107. HeadColor = BrickColor.new("Pastel brown"),
  2108. TorsoColor = BrickColor.new("Pastel brown"),
  2109. RightArmColor = BrickColor.new("Pastel brown"),
  2110. LeftArmColor = BrickColor.new("Pastel brown"),
  2111. RightLegColor = BrickColor.new("White"),
  2112. LeftLegColor = BrickColor.new("White"),
  2113. CharacterAssets = {
  2114. 134289125, 48474356,
  2115. 100339040, 46302558,
  2116. 153955895
  2117. },
  2118. HeadAssets = {},
  2119. TShirt = "rbxassetid://148856353"
  2120. }
  2121. ]])
  2122. Module.Create("PlayerControl", [[
  2123. PlayerControl.fly_acceleration = 10
  2124. PlayerControl.fly_basespeed = 250
  2125. PlayerControl.fly_speed = PlayerControl.fly_basespeed
  2126. PlayerControl.featherfallEnabled = true
  2127. PlayerControl.pushable = false
  2128. PlayerControl.rolling = false
  2129. PlayerControl.rollingAngle = 0
  2130. PlayerControl.rollingOffset = 0
  2131. PlayerControl.rollingMaxOffset = 3
  2132. PlayerControl.rollingSpeed = 1 / 50
  2133. PlayerControl.characterEnabled = false
  2134. PlayerControl.characterMode = "normal"
  2135. local character = nil
  2136. local flying, flyingMomentum, flyingTilt = false, Vector3.new(), 0
  2137. local pose, regeneratingHealth, jumpDebounce = "Standing", false, false
  2138. -- TODO: make local variables public
  2139. local model, bodyColors, leftArmMesh, leftLegMesh, rightArmMesh, rightLegMesh, torsoMesh, wildcardHat, wildcardHandle, wildcardMesh, pants, shirt, humanoid,
  2140.  
  2141. head, leftArm, leftLeg, rightArm, rightLeg, torso, rootPart, rootJoint, face, soundFreeFalling, soundGettingUp, soundRunning, leftHip, leftShoulder,
  2142.  
  2143. rightHip, rightShoulder, neck, wildcardWeld, feetPart, feetWeld, feetTouchInterest, bodyGyro, bodyVelocity, headMesh, torsoLight
  2144. local AnimateCharacter
  2145. local chatBubbles = {}
  2146. local chatCharacterLimit = 240
  2147. function PlayerControl.Chat(message)
  2148. Network.TransmitServer(string.format("ChatBubble.Create(%q)", tostring(message)))
  2149. end
  2150. function PlayerControl.CreateCharacter()
  2151. local characterMode = PlayerControl.characterMode
  2152. if characterMode == "normal" then
  2153. if not PlayerControl.characterEnabled then
  2154. return
  2155. end
  2156. local appearance = CharacterAppearance.GetDefaultAppearance()
  2157. local active = true
  2158. local torsoCFrame = (torso and torso.CFrame) or PlayerControl.torso_cframe or CFrame.new(0, 10, 0)
  2159. if torsoCFrame.p.Y < -450 then
  2160. torsoCFrame = CFrame.new(0, 10, 0)
  2161. end
  2162. local rootPartCFrame = (rootPart and rootPart.CFrame) or PlayerControl.torso_cframe or CFrame.new(0, 10, 0)
  2163. if rootPartCFrame.p.Y < -450 then
  2164. rootPartCFrame = CFrame.new(0, 10, 0)
  2165. end
  2166. local cameraCFrame = Camera.CoordinateFrame
  2167. local connections = {}
  2168. local feetTouching = {}
  2169. local previousWalkSpeed = 0
  2170. local prevLeftHip, prevLeftShoulder, prevRightHip, prevRightShoulder = leftHip, leftShoulder, rightHip, rightShoulder
  2171. model = Instance.new("Model")
  2172. humanoid = Instance.new("Humanoid", model)
  2173. head = Instance.new("Part", model)
  2174. leftArm = Instance.new("Part", model)
  2175. leftLeg = Instance.new("Part", model)
  2176. rightArm = Instance.new("Part", model)
  2177. rightLeg = Instance.new("Part", model)
  2178. torso = Instance.new("Part", model)
  2179. rootPart = Instance.new("Part", model)
  2180. soundFallingDown = Instance.new("Sound", head)
  2181. soundFreeFalling = Instance.new("Sound", head)
  2182. soundGettingUp = Instance.new("Sound", head)
  2183. soundJumping = Instance.new("Sound", head)
  2184. soundRunning = Instance.new("Sound", head)
  2185. leftHip = Instance.new("Motor", torso)
  2186. leftShoulder = Instance.new("Motor", torso)
  2187. rightHip = Instance.new("Motor", torso)
  2188. rightShoulder = Instance.new("Motor", torso)
  2189. neck = Instance.new("Motor", torso)
  2190. rootJoint = Instance.new("Motor", rootPart)
  2191. feetPart = Instance.new("Part", model)
  2192. feetWeld = Instance.new("Weld", torso)
  2193. bodyGyro = Instance.new("BodyGyro", rootPart)
  2194. bodyVelocity = Instance.new("BodyVelocity", rootPart)
  2195. model.Archivable = false
  2196. model.Name = UserInterface.player_name
  2197. model.PrimaryPart = head
  2198. humanoid.LeftLeg = leftLeg
  2199. humanoid.RightLeg = rightLeg
  2200. humanoid.Torso = rootPart
  2201. head.CFrame = torsoCFrame * CFrame.new(0, 1.5, 0)
  2202. head.FormFactor = "Symmetric"
  2203. head.Locked = true
  2204. head.Name = "Head"
  2205. head.Size = Vector3.new(2, 1, 1)
  2206. head.TopSurface = "Smooth"
  2207. leftArm.CanCollide = false
  2208. leftArm.CFrame = torsoCFrame * CFrame.new(-1.5, 0, 0)
  2209. leftArm.FormFactor = "Symmetric"
  2210. leftArm.Locked = true
  2211. leftArm.Name = "Left Arm"
  2212. leftArm.Size = Vector3.new(1, 2, 1)
  2213. leftLeg.BottomSurface = "Smooth"
  2214. leftLeg.CanCollide = false
  2215. leftLeg.CFrame = torsoCFrame * CFrame.new(-0.5, -2, 0)
  2216. leftLeg.FormFactor = "Symmetric"
  2217. leftLeg.Locked = true
  2218. leftLeg.Name = "Left Leg"
  2219. leftLeg.Size = Vector3.new(1, 2, 1)
  2220. leftLeg.TopSurface = "Smooth"
  2221. rightArm.CanCollide = false
  2222. rightArm.CFrame = torsoCFrame * CFrame.new(1.5, 0, 0)
  2223. rightArm.FormFactor = "Symmetric"
  2224. rightArm.Locked = true
  2225. rightArm.Name = "Right Arm"
  2226. rightArm.Size = Vector3.new(1, 2, 1)
  2227. rightLeg.BottomSurface = "Smooth"
  2228. rightLeg.CanCollide = false
  2229. rightLeg.CFrame = torsoCFrame * CFrame.new(0.5, -2, 0)
  2230. rightLeg.FormFactor = "Symmetric"
  2231. rightLeg.Locked = true
  2232. rightLeg.Name = "Right Leg"
  2233. rightLeg.Size = Vector3.new(1, 2, 1)
  2234. rightLeg.TopSurface = "Smooth"
  2235. torso.CFrame = torsoCFrame
  2236. torso.FormFactor = "Symmetric"
  2237. torso.LeftSurface = "Weld"
  2238. torso.Locked = true
  2239. torso.RightSurface = "Weld"
  2240. torso.Name = "Torso"
  2241. torso.Size = Vector3.new(2, 2, 1)
  2242. rootPart.BottomSurface = "Smooth"
  2243. rootPart.BrickColor = BrickColor.Blue()
  2244. rootPart.CFrame = rootPartCFrame
  2245. rootPart.FormFactor = "Symmetric"
  2246. rootPart.LeftSurface = "Weld"
  2247. rootPart.Locked = true
  2248. rootPart.RightSurface = "Weld"
  2249. rootPart.Name = "HumanoidRootPart"
  2250. rootPart.Size = Vector3.new(2, 2, 1)
  2251. rootPart.TopSurface = "Smooth"
  2252. rootPart.Transparency = 1
  2253. soundFreeFalling.Archivable = false
  2254. soundFreeFalling.SoundId = "rbxasset://sounds/swoosh.wav"
  2255. soundGettingUp.Archivable = false
  2256. soundGettingUp.SoundId = "rbxasset://sounds/hit.wav"
  2257. soundRunning.Archivable = false
  2258. soundRunning.SoundId = "rbxasset://sounds/bfsl-minifigfoots1.mp3"
  2259. soundRunning.Looped = true
  2260. leftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2261. leftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2262. leftHip.MaxVelocity = 0.1
  2263. leftHip.Name = "Left Hip"
  2264. leftHip.Part0 = torso
  2265. leftHip.Part1 = leftLeg
  2266. leftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2267. leftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2268. leftShoulder.MaxVelocity = 0.15
  2269. leftShoulder.Name = "Left Shoulder"
  2270. leftShoulder.Part0 = torso
  2271. leftShoulder.Part1 = leftArm
  2272. rightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2273. rightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2274. rightHip.MaxVelocity = 0.1
  2275. rightHip.Name = "Right Hip"
  2276. rightHip.Part0 = torso
  2277. rightHip.Part1 = rightLeg
  2278. rightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2279. rightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2280. rightShoulder.MaxVelocity = 0.15
  2281. rightShoulder.Name = "Right Shoulder"
  2282. rightShoulder.Part0 = torso
  2283. rightShoulder.Part1 = rightArm
  2284. if prevLeftHip then
  2285. leftHip.CurrentAngle = prevLeftHip.CurrentAngle
  2286. leftHip.DesiredAngle = prevLeftHip.DesiredAngle
  2287. end
  2288. if prevLeftShoulder then
  2289. leftShoulder.CurrentAngle = prevLeftShoulder.CurrentAngle
  2290. leftShoulder.DesiredAngle = prevLeftShoulder.DesiredAngle
  2291. end
  2292. if prevRightHip then
  2293. rightHip.CurrentAngle = prevRightHip.CurrentAngle
  2294. rightHip.DesiredAngle = prevRightHip.DesiredAngle
  2295. end
  2296. if prevRightShoulder then
  2297. rightShoulder.CurrentAngle = prevRightShoulder.CurrentAngle
  2298. rightShoulder.DesiredAngle = prevRightShoulder.DesiredAngle
  2299. end
  2300. neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  2301. neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  2302. neck.Name = "Neck"
  2303. neck.Part0 = torso
  2304. neck.Part1 = head
  2305. rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  2306. rootJoint.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  2307. rootJoint.Name = "RootJoint"
  2308. rootJoint.Part0 = rootPart
  2309. rootJoint.Part1 = torso
  2310. feetPart.BottomSurface = "Smooth"
  2311. feetPart.CanCollide = false
  2312. feetPart.CFrame = torsoCFrame * CFrame.new(0, -3.1, 0)
  2313. feetPart.FormFactor = "Custom"
  2314. feetPart.Locked = true
  2315. feetPart.Name = "Platform"
  2316. feetPart.Size = Vector3.new(1.8, 0.2, 0.8)
  2317. feetPart.TopSurface = "Smooth"
  2318. feetPart.Transparency = 1
  2319. feetWeld.C0 = CFrame.new(0, -3, 0)
  2320. feetWeld.C1 = CFrame.new(0, 0.1, 0)
  2321. feetWeld.Name = "PlatformWeld"
  2322. feetWeld.Part0 = torso
  2323. feetWeld.Part1 = feetPart
  2324. table.insert(connections, feetPart.Touched:connect(function(hit)
  2325. feetTouching[hit] = true
  2326. end))
  2327. table.insert(connections, feetPart.TouchEnded:connect(function(hit)
  2328. feetTouching[hit] = nil
  2329. end))
  2330. feetTouchInterest = feetPart:FindFirstChild("TouchInterest")
  2331. bodyGyro.D = 3250
  2332. bodyGyro.P = 400000
  2333. bodyGyro.maxTorque = Vector3.new(1000000000, 0, 1000000000)
  2334. bodyVelocity.P = 5000
  2335. bodyVelocity.maxForce = Vector3.new(0, 0, 0)
  2336. bodyVelocity.velocity = Vector3.new(0, 0, 0)
  2337. torsoLight = Instance.new("PointLight", torso)
  2338. torsoLight.Brightness = 0.4
  2339. torsoLight.Color = Color3.new(1, 1, 1)
  2340. torsoLight.Range = 16
  2341. torsoLight.Shadows = true
  2342. local ff1, ff2, ff3, ff4, ff5, ff6, ff7, ff8, ff9 = Instance.new("ForceField", head), Instance.new("ForceField", leftArm), Instance.new
  2343.  
  2344. ("ForceField", leftLeg), Instance.new("ForceField", rightArm), Instance.new("ForceField", rightLeg), Instance.new("ForceField", torso), Instance.new
  2345.  
  2346. ("ForceField", wildcardHandle), Instance.new("ForceField", feetPart), Instance.new("ForceField", rootPart)
  2347. local forcefields = {[ff1] = head, [ff2] = leftArm, [ff3] = leftLeg, [ff4] = rightArm, [ff5] = rightLeg, [ff6] = torso, [ff7] =
  2348.  
  2349. wildcardHandle, [ff8] = feetPart, [ff9] = rootPart}
  2350. local objects = {[humanoid] = true, [head] = true, [leftArm] = true, [leftLeg] = true, [rightArm] = true, [rightLeg] = true, [torso] = true,
  2351.  
  2352. [rootPart] = true, [rootJoint] = true, [soundFreeFalling] = true, [soundGettingUp] = true, [soundRunning] = true, [leftHip] = true, [leftShoulder] = true,
  2353.  
  2354. [rightHip] = true, [rightShoulder] = true, [neck] = true, [feetPart] = true, [feetWeld] = true, [feetTouchInterest] = true, [bodyGyro] = true,
  2355.  
  2356. [bodyVelocity] = true, [ff1] = true, [ff2] = true, [ff3] = true, [ff4] = true, [ff5] = true, [ff6] = true, [ff7] = true, [ff8] = true, [ff9] = true}
  2357. local tshirtUrl = appearance.tshirt
  2358. if tshirtUrl then
  2359. local tshirt = Instance.new("Decal", torso)
  2360. tshirt.Name = "roblox"
  2361. tshirt.Texture = tshirtUrl
  2362. objects[tshirt] = true
  2363. end
  2364. for _, template in ipairs(appearance.characterObjects) do
  2365. local object = template:Clone()
  2366. local newObjects = {object}
  2367. for _, object in ipairs(newObjects) do
  2368. objects[object] = true
  2369. for _, child in ipairs(object:GetChildren()) do
  2370. table.insert(newObjects, child)
  2371. end
  2372. end
  2373. if object:IsA("BodyColors") then
  2374. head.BrickColor = object.HeadColor
  2375. leftArm.BrickColor = object.LeftArmColor
  2376. leftLeg.BrickColor = object.LeftLegColor
  2377. rightArm.BrickColor = object.RightArmColor
  2378. rightLeg.BrickColor = object.RightLegColor
  2379. torso.BrickColor = object.TorsoColor
  2380. elseif object:IsA("Hat") then
  2381. local handle = object:FindFirstChild("Handle")
  2382. if handle and handle:IsA("BasePart") then
  2383. local weld = Instance.new("Weld", head)
  2384. weld.C0 = CFrame.new(0, 0.5, 0)
  2385. local attachmentPos = object.AttachmentPos
  2386. local attachmentRight = object.AttachmentRight
  2387. local attachmentUp = object.AttachmentUp
  2388. local attachmentForward = object.AttachmentForward
  2389. weld.C1 = CFrame.new(attachmentPos.X, attachmentPos.Y, attachmentPos.Z,
  2390. attachmentRight.X, attachmentUp.X, -attachmentForward.X,
  2391. attachmentRight.Y, attachmentUp.Y, -attachmentForward.Y,
  2392. attachmentRight.Z, attachmentUp.Z, -attachmentForward.Z)
  2393. weld.Name = "HeadWeld"
  2394. weld.Part0 = head
  2395. weld.Part1 = handle
  2396. handle.Parent = model
  2397. local antiGravity = Instance.new("BodyForce", handle)
  2398. antiGravity.force = Vector3.new(0, handle:GetMass() * 196.2, 0)
  2399. objects[object] = false
  2400. object.Parent = nil
  2401. objects[weld] = true
  2402. end
  2403. end
  2404. object.Parent = model
  2405. end
  2406. local facePresent = false
  2407. local headMeshPresent = false
  2408. for _, template in ipairs(appearance.headObjects) do
  2409. local object = template:Clone()
  2410. local newObjects = {object}
  2411. for _, object in ipairs(newObjects) do
  2412. objects[object] = true
  2413. for _, child in ipairs(object:GetChildren()) do
  2414. table.insert(newObjects, child)
  2415. end
  2416. end
  2417. if object:IsA("DataModelMesh") then
  2418. headMeshPresent = true
  2419. elseif object:IsA("Decal") then
  2420. facePresent = true
  2421. end
  2422. object.Parent = head
  2423. end
  2424. if not facePresent then
  2425. local face = Instance.new("Decal", head)
  2426. face.Texture = "rbxasset://textures/face.png"
  2427. objects[face] = true
  2428. end
  2429. if not headMeshPresent then
  2430. local headMesh = Instance.new("SpecialMesh", head)
  2431. headMesh.Scale = Vector3.new(1.25, 1.25, 1.25)
  2432. objects[headMesh] = true
  2433. end
  2434. table.insert(connections, model.DescendantAdded:connect(function(object)
  2435. local success, is_localscript = pcall(Game.IsA, object, "LocalScript")
  2436. if success and is_localscript then
  2437. pcall(Utility.SetProperty, object, "Disabled", true)
  2438. local changed_connection = pcall(object.Changed.connect, object.Changed, function(property)
  2439. if property == "Disabled" and not object.Disabled then
  2440. pcall(Utility.SetProperty, object, "Disabled", true)
  2441. Network.TransmitServer("(...):Destroy()", object)
  2442. end
  2443. end)
  2444. end
  2445. if not objects[object] then
  2446. Network.TransmitServer("(...):Destroy()", object)
  2447. end
  2448. end))
  2449. model.Parent = Workspace
  2450. Player.Character = model
  2451. Camera.CameraSubject = humanoid
  2452. Camera.CameraType = "Track"
  2453. Camera.CoordinateFrame = cameraCFrame
  2454. local IsStanding
  2455. local RegenerateHealth
  2456. local ResetCharacter
  2457. function IsStanding()
  2458. return not not next(feetTouching)
  2459. end
  2460. function RegenerateHealth()
  2461. if humanoid.Health < 1 then
  2462. humanoid.Health = 100
  2463. elseif not regeneratingHealth then
  2464. regeneratingHealth = true
  2465. local elapsedTime = wait(1)
  2466. regeneratingHealth = false
  2467. if humanoid.Health < 100 then
  2468. humanoid.Health = math.min(humanoid.Health + elapsedTime, 100)
  2469. end
  2470. end
  2471. end
  2472. function ResetCharacter()
  2473. for index, connection in ipairs(connections) do
  2474. connection:disconnect()
  2475. end
  2476. active = false
  2477. end
  2478. table.insert(connections, model.AncestryChanged:connect(ResetCharacter))
  2479. table.insert(connections, model.DescendantRemoving:connect(function(object)
  2480. local parent = forcefields[object]
  2481. if parent then
  2482. forcefields[object] = nil
  2483. local new_forcefield = Instance.new("ForceField")
  2484. forcefields[new_forcefield] = parent
  2485. objects[new_forcefield] = true
  2486. new_forcefield.Parent = parent
  2487. elseif objects[object] then
  2488. ResetCharacter()
  2489. end
  2490. end))
  2491. table.insert(connections, humanoid.HealthChanged:connect(RegenerateHealth))
  2492. table.insert(connections, humanoid.Climbing:connect(function() pose = "Climbing" end))
  2493. table.insert(connections, humanoid.FallingDown:connect(function(state) pose = "FallingDown" end))
  2494. table.insert(connections, humanoid.FreeFalling:connect(function(state) pose = "FreeFall" if state then soundFreeFalling:Play() else
  2495.  
  2496. soundFreeFalling:Pause() end end))
  2497. table.insert(connections, humanoid.GettingUp:connect(function(state) pose = "GettingUp" if state then soundGettingUp:Play() else
  2498.  
  2499. soundGettingUp:Pause() end end))
  2500. table.insert(connections, humanoid.PlatformStanding:connect(function() pose = "PlatformStanding" end))
  2501. table.insert(connections, humanoid.Seated:connect(function() pose = "Seated" end))
  2502. table.insert(connections, humanoid.Swimming:connect(function(speed) if speed > 0 then pose = "Swimming" else pose = "Standing" end end))
  2503. local previousRootPartCFrame = rootPart.CFrame
  2504. TaskScheduler.Start(function()
  2505. while active do
  2506. local totalTime = TaskScheduler.GetCurrentTime()
  2507. local stepTime = 1 / 60
  2508. if not PlayerControl.characterEnabled then
  2509. ResetCharacter()
  2510. break
  2511. end
  2512. torsoLight.Brightness = 0.5 + 0.15 * math.sin(totalTime * 0.75 * math.pi)
  2513. local featherfallEnabled = PlayerControl.IsFeatherfallEnabled()
  2514. local rootPartCFrame = rootPart.CFrame
  2515. if not jumpDebounce and UserInterface.IsKeyDown(" ") then
  2516. if humanoid.Sit then
  2517. humanoid.Sit = false
  2518. end
  2519. if IsStanding() then
  2520. jumpDebounce = true
  2521. pose = "Jumping"
  2522. rootPart.Velocity = Vector3.new(rootPart.Velocity.X, 50, rootPart.Velocity.Z)
  2523. torso.Velocity = Vector3.new(torso.Velocity.X, 50, torso.Velocity.Z)
  2524. TaskScheduler.Schedule(1, function()
  2525. if pose == "Jumping" then
  2526. pose = "FreeFall"
  2527. end
  2528. jumpDebounce = false
  2529. humanoid.Jump = false
  2530. end)
  2531. end
  2532. end
  2533. local cameraCFrame = Camera.CoordinateFrame
  2534. local cameraDirection = cameraCFrame.lookVector
  2535. if flying then
  2536. if PlayerControl.rolling then
  2537. local rootPartCFrame = rootPart.CFrame
  2538. local speed = (rootPartCFrame - rootPartCFrame.p):pointToObjectSpace(rootPart.Velocity).Y
  2539. local decay = 0.5 ^ stepTime
  2540. if math.abs(speed) <= 50 then
  2541. PlayerControl.rollingAngle = (((PlayerControl.rollingAngle + 0.5) % 1 - 0.5) * decay) % 1
  2542. PlayerControl.rollingOffset = PlayerControl.rollingOffset * decay
  2543. else
  2544. PlayerControl.rollingAngle = (PlayerControl.rollingAngle + stepTime * speed *
  2545.  
  2546. PlayerControl.rollingSpeed) % 1
  2547. PlayerControl.rollingOffset = (PlayerControl.rollingOffset + PlayerControl.rollingMaxOffset * (1 /
  2548.  
  2549. decay - 1)) * decay
  2550. end
  2551. rootJoint.C0 = (CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) * CFrame.Angles(PlayerControl.rollingAngle *
  2552.  
  2553. 2 * math.pi, 0, 0)) * CFrame.new(0, -PlayerControl.rollingOffset, 0)
  2554. else
  2555. rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  2556. PlayerControl.rollingAngle = 0
  2557. PlayerControl.rollingOffset = 0
  2558. end
  2559. rightShoulder.MaxVelocity = 0.5
  2560. leftShoulder.MaxVelocity = 0.5
  2561. rightShoulder.DesiredAngle = 0
  2562. leftShoulder.DesiredAngle = 0
  2563. rightHip.DesiredAngle = 0
  2564. leftHip.DesiredAngle = 0
  2565. bodyGyro.D = 500
  2566. bodyGyro.P = 1e6
  2567. bodyGyro.maxTorque = Vector3.new(1e6, 1e6, 1e6)
  2568. bodyVelocity.P = 1250
  2569. bodyVelocity.maxForce = Vector3.new(1e6, 1e6, 1e6)
  2570. local movementRight = 0
  2571. local movementForward = 0
  2572. local movementUp = 0
  2573. if UserInterface.IsKeyDown("a") and not UserInterface.IsKeyDown("d") then
  2574. movementRight = -1
  2575. elseif UserInterface.IsKeyDown("d") then
  2576. movementRight = 1
  2577. end
  2578. if UserInterface.IsKeyDown("w") then
  2579. movementUp = 0.2
  2580. if not UserInterface.IsKeyDown("s") then
  2581. movementForward = -1
  2582. end
  2583. elseif UserInterface.IsKeyDown("s") then
  2584. movementForward = 1
  2585. end
  2586. local movement = PlayerControl.fly_acceleration * cameraCFrame:vectorToWorldSpace(Vector3.new(movementRight,
  2587.  
  2588. movmentUp, movementForward))
  2589. local previousMomentum = flyingMomentum
  2590. local previousTilt = flyingTilt
  2591. flyingMomentum = movement + flyingMomentum * (1 - PlayerControl.fly_acceleration / PlayerControl.fly_speed)
  2592. flyingTilt = ((flyingMomentum * Vector3.new(1, 0, 1)).unit:Cross((previousMomentum * Vector3.new(1, 0, 1)).unit)).Y
  2593. if flyingTilt ~= flyingTilt or flyingTilt == math.huge then
  2594. flyingTilt = 0
  2595. end
  2596. local absoluteTilt = math.abs(flyingTilt)
  2597. if absoluteTilt > 0.06 or absoluteTilt < 0.0001 then
  2598. if math.abs(previousTilt) > 0.0001 then
  2599. flyingTilt = previousTilt * 0.9
  2600. else
  2601. flyingTilt = 0
  2602. end
  2603. else
  2604. flyingTilt = previousTilt * 0.77 + flyingTilt * 0.25
  2605. end
  2606. previousTilt = flyingTilt
  2607. if flyingMomentum.magnitude < 0.1 then
  2608. flyingMomentum = Vector3.new(0, 0, 0)
  2609. -- bodyGyro.cframe = cameraCFrame
  2610. else
  2611. local momentumOrientation = CFrame.new(Vector3.new(0, 0, 0), flyingMomentum)
  2612. local tiltOrientation = CFrame.Angles(0, 0, -20 * flyingTilt)
  2613. bodyGyro.cframe = momentumOrientation * tiltOrientation * CFrame.Angles(-0.5 * math.pi * math.min
  2614.  
  2615. (flyingMomentum.magnitude / PlayerControl.fly_speed, 1), 0, 0)
  2616. end
  2617. bodyVelocity.velocity = flyingMomentum + Vector3.new(0, 0.15695775618683547, 0)
  2618. rootPart.Velocity = flyingMomentum
  2619. previousMomentum = flyingMomentum
  2620. else
  2621. rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  2622. PlayerControl.rollingAngle = 0
  2623. PlayerControl.rollingOffset = 0
  2624. bodyGyro.D = 3250
  2625. bodyGyro.P = 400000
  2626. bodyVelocity.P = 5000
  2627. local cameraDirection = cameraCFrame.lookVector
  2628. local walkDirection = Vector3.new(0, 0, 0)
  2629. local walkSpeed = 16
  2630. if UserInterface.IsKeyDown("w") or UserInterface.IsKeyDown("\17") then
  2631. if UserInterface.IsKeyDown("a") then
  2632. walkDirection = Vector3.new(cameraDirection.X + cameraDirection.Z, 0, cameraDirection.Z -
  2633.  
  2634. cameraDirection.X).unit
  2635. elseif UserInterface.IsKeyDown("d") then
  2636. walkDirection = Vector3.new(cameraDirection.X - cameraDirection.Z, 0, cameraDirection.Z +
  2637.  
  2638. cameraDirection.X).unit
  2639. else
  2640. walkDirection = Vector3.new(cameraDirection.X, 0, cameraDirection.Z).unit
  2641. end
  2642. elseif UserInterface.IsKeyDown("s") or UserInterface.IsKeyDown("\18") then
  2643. if UserInterface.IsKeyDown("a") then
  2644. walkDirection = Vector3.new(-cameraDirection.X + cameraDirection.Z, 0, -cameraDirection.Z -
  2645.  
  2646. cameraDirection.X).unit
  2647. elseif UserInterface.IsKeyDown("d") then
  2648. walkDirection = Vector3.new(-cameraDirection.X - cameraDirection.Z, 0, -cameraDirection.Z +
  2649.  
  2650. cameraDirection.X).unit
  2651. else
  2652. walkDirection = Vector3.new(-cameraDirection.X, 0, -cameraDirection.Z).unit
  2653. end
  2654. elseif UserInterface.IsKeyDown("a") then
  2655. walkDirection = Vector3.new(cameraDirection.Z, 0, -cameraDirection.X).unit
  2656. elseif UserInterface.IsKeyDown("d") then
  2657. walkDirection = Vector3.new(-cameraDirection.Z, 0, cameraDirection.X).unit
  2658. else
  2659. walkSpeed = 0
  2660. end
  2661. if walkSpeed ~= previousWalkSpeed then
  2662. if walkSpeed > 0 then
  2663. soundRunning:Play()
  2664. else
  2665. soundRunning:Pause()
  2666. end
  2667. end
  2668. if walkSpeed > 0 then
  2669. if pose ~= "Jumping" then
  2670. if IsStanding() then
  2671. pose = "Running"
  2672. else
  2673. pose = "FreeFall"
  2674. end
  2675. end
  2676. bodyGyro.cframe = CFrame.new(Vector3.new(), walkDirection)
  2677. bodyGyro.maxTorque = Vector3.new(1000000000, 1000000000, 1000000000)
  2678. bodyVelocity.maxForce = Vector3.new(1000000, maxForceY, 1000000)
  2679. else
  2680. if pose ~= "Jumping" then
  2681. if IsStanding() then
  2682. pose = "Standing"
  2683. else
  2684. pose = "FreeFall"
  2685. end
  2686. end
  2687. -- TODO: find and fix bug that causes torso to rotate back to some angle
  2688. bodyGyro.maxTorque = Vector3.new(1000000000, 1000000000, 1000000000) -- Vector3.new(1000000000, 0,
  2689.  
  2690. 1000000000)
  2691. if PlayerControl.pushable then
  2692. bodyVelocity.maxForce = Vector3.new(0, 0, 0)
  2693. else
  2694. bodyVelocity.maxForce = Vector3.new(1000000, 0, 1000000)
  2695. end
  2696. end
  2697. if featherfallEnabled then
  2698. local velocity = rootPart.Velocity
  2699. if velocity.Y > 50 then
  2700. rootPart.Velocity = Vector3.new(velocity.X, 50, velocity.Z)
  2701. elseif velocity.Y < -50 then
  2702. rootPart.Velocity = Vector3.new(velocity.X, -50, velocity.Z)
  2703. end
  2704. local distanceVector = rootPartCFrame.p - previousRootPartCFrame.p
  2705. local offsetX, offsetY, offsetZ = distanceVector.X, distanceVector.Y, distanceVector.Z
  2706. local MAX_MOVEMENT = 50 * 0.03333333507180214
  2707. if offsetX > MAX_MOVEMENT then
  2708. offsetX = MAX_MOVEMENT
  2709. elseif offsetX < -MAX_MOVEMENT then
  2710. offsetX = -MAX_MOVEMENT
  2711. end
  2712. if offsetY > MAX_MOVEMENT then
  2713. offsetY = MAX_MOVEMENT
  2714. elseif offsetY < -MAX_MOVEMENT then
  2715. offsetY = -MAX_MOVEMENT
  2716. end
  2717. if offsetZ > MAX_MOVEMENT then
  2718. offsetZ = MAX_MOVEMENT
  2719. elseif offsetZ < -MAX_MOVEMENT then
  2720. offsetZ = -MAX_MOVEMENT
  2721. end
  2722. local offset = Vector3.new(offsetX, offsetY, offsetZ)
  2723. if offset ~= distanceVector then
  2724. rootPartCFrame = previousRootPartCFrame + offset
  2725. --rootPart.CFrame = rootPartCFrame
  2726. end
  2727. end
  2728. local walkingVelocity = walkDirection * walkSpeed
  2729. bodyVelocity.velocity = walkingVelocity
  2730. if not jumpDebounce and math.abs(rootPart.Velocity.Y) <= 0.1 then
  2731. rootPart.Velocity = Vector3.new(walkingVelocity.X, rootPart.Velocity.Y, walkingVelocity.Z)
  2732. end
  2733. previousWalkSpeed = walkSpeed
  2734. if pose == "Jumping" or jumpDebounce then
  2735. rightShoulder.MaxVelocity = 0.5
  2736. leftShoulder.MaxVelocity = 0.5
  2737. rightShoulder.DesiredAngle = 3.14
  2738. leftShoulder.DesiredAngle = -3.14
  2739. rightHip.DesiredAngle = 0
  2740. leftHip.DesiredAngle = 0
  2741. elseif pose == "FreeFall" then
  2742. rightShoulder.MaxVelocity = 0.5
  2743. leftShoulder.MaxVelocity = 0.5
  2744. rightShoulder.DesiredAngle = 3.14
  2745. leftShoulder.DesiredAngle = -3.14
  2746. rightHip.DesiredAngle = 0
  2747. leftHip.DesiredAngle = 0
  2748. elseif pose == "Seated" then
  2749. rightShoulder.MaxVelocity = 0.15
  2750. leftShoulder.MaxVelocity = 0.15
  2751. rightShoulder.DesiredAngle = 3.14 / 2
  2752. leftShoulder.DesiredAngle = -3.14 / 2
  2753. rightHip.DesiredAngle = 3.14 / 2
  2754. leftHip.DesiredAngle = -3.14 / 2
  2755. else
  2756. local climbFudge = 0
  2757. local amplitude
  2758. local frequency
  2759. if pose == "Running" then
  2760. rightShoulder.MaxVelocity = 0.15
  2761. leftShoulder.MaxVelocity = 0.15
  2762. amplitude = 1
  2763. frequency = 9
  2764. elseif (pose == "Climbing") then
  2765. rightShoulder.MaxVelocity = 0.5
  2766. leftShoulder.MaxVelocity = 0.5
  2767. amplitude = 1
  2768. frequency = 9
  2769. climbFudge = 3.14
  2770. else
  2771. amplitude = 0.1
  2772. frequency = 1
  2773. end
  2774. local desiredAngle = amplitude * math.sin(totalTime * frequency)
  2775. rightShoulder.DesiredAngle = desiredAngle + climbFudge
  2776. leftShoulder.DesiredAngle = desiredAngle - climbFudge
  2777. rightHip.DesiredAngle = -desiredAngle
  2778. leftHip.DesiredAngle = -desiredAngle
  2779. end
  2780. end
  2781. previousRootPartCFrame = rootPartCFrame
  2782. RunService.RenderStepped:wait()
  2783. end
  2784. if model.Parent ~= nil then
  2785. model.Parent = nil
  2786. end
  2787. PlayerControl.CreateCharacter()
  2788. end)
  2789. humanoid.Health = 100
  2790. character = model
  2791. Network.TransmitServer("chatAdornee = ...", head)
  2792. elseif characterMode == "pyramid" then
  2793. if PlayerControl.characterEnabled then
  2794. Camera.CameraType = "Fixed"
  2795. PyramidCharacter.camera_distance = (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude
  2796. PyramidCharacter.camera_position = Camera.Focus.p
  2797. PyramidCharacter.Teleport(Camera.Focus.p)
  2798. PyramidCharacter.visible = true
  2799. Player.Character = nil
  2800. else
  2801. PyramidCharacter.visible = false
  2802. end
  2803. end
  2804. end
  2805. function PlayerControl.GetCharacter()
  2806. return character
  2807. end
  2808. function PlayerControl.GetHead()
  2809. local characterMode = PlayerControl.characterMode
  2810. if characterMode == "normal" then
  2811. return head
  2812. elseif characterMode == "pyramid" then
  2813. return PyramidCharacter.core
  2814. end
  2815. end
  2816. function PlayerControl.GetHumanoid()
  2817. return humanoid
  2818. end
  2819. function PlayerControl.GetRootPart()
  2820. return rootPart
  2821. end
  2822. function PlayerControl.GetTorso()
  2823. return torso
  2824. end
  2825. function PlayerControl.IsEnabled()
  2826. return PlayerControl.characterEnabled
  2827. end
  2828. function PlayerControl.IsFeatherfallEnabled()
  2829. return PlayerControl.featherfallEnabled
  2830. end
  2831. function PlayerControl.IsPushable()
  2832. return PlayerControl.pushable
  2833. end
  2834. function PlayerControl.IsRolling()
  2835. return PlayerControl.rolling
  2836. end
  2837. function PlayerControl.ResetCharacter()
  2838. if character and character.Parent then
  2839. character.Parent = nil
  2840. end
  2841. PyramidCharacter.visible = false
  2842. end
  2843. function PlayerControl.SetEnabled(state, no_animation)
  2844. state = not not state
  2845. if state ~= PlayerControl.characterEnabled then
  2846. PlayerControl.characterEnabled = state
  2847. local characterMode = PlayerControl.characterMode
  2848. if characterMode == "normal" then
  2849. local torso = PlayerControl.GetRootPart()
  2850. local rootPart = PlayerControl.GetRootPart()
  2851. if rootPart then
  2852. if PlayerControl.characterEnabled then
  2853. local torso_cframe = Camera.Focus:toWorldSpace(PlayerControl.hide_torso_object_cframe)
  2854. PlayerControl.torso_cframe = torso_cframe
  2855. torso.CFrame = torso_cframe
  2856. rootPart.CFrame = torso_cframe
  2857. else
  2858. PlayerControl.hide_torso_object_cframe = Camera.Focus:toObjectSpace(rootPart.CFrame)
  2859. end
  2860. else
  2861. PlayerControl.torso_cframe = Camera.Focus
  2862. end
  2863. if PlayerControl.characterEnabled then
  2864. PlayerControl.CreateCharacter()
  2865. RunService.Stepped:wait()
  2866. coroutine.yield()
  2867. if not no_animation then
  2868. Network.TransmitServer("GraphicalEffects.CrystalRing({base_part = (...), crystal_color = BrickColor.new
  2869.  
  2870. (\"Institutional white\"), float_duration = 2})", PlayerControl.GetTorso())
  2871. end
  2872. else
  2873. Player.Character = nil
  2874. Camera.CameraType = "Fixed"
  2875. if not no_animation then
  2876. Network.TransmitServer("GraphicalEffects.CrystalRing({position = (...), crystal_color = BrickColor.new
  2877.  
  2878. (\"Institutional white\"), float_duration = 2})", PlayerControl.GetTorso().Position)
  2879. end
  2880. end
  2881. else
  2882. if state then
  2883. PlayerControl.CreateCharacter()
  2884. RunService.Stepped:wait()
  2885. coroutine.yield()
  2886. if not no_animation then
  2887. Network.TransmitServer("GraphicalEffects.CrystalRing({base_part = (...), crystal_color = BrickColor.new
  2888.  
  2889. (\"Institutional white\"), float_duration = 2})", PyramidCharacter.core)
  2890. end
  2891. else
  2892. PyramidCharacter.visible = false
  2893. if not no_animation then
  2894. Network.TransmitServer("GraphicalEffects.CrystalRing({position = (...), crystal_color = BrickColor.new
  2895.  
  2896. (\"Institutional white\"), float_duration = 2})", PyramidCharacter.core.Position)
  2897. end
  2898. end
  2899. end
  2900. end
  2901. end
  2902. function PlayerControl.SetFeatherfallEnabled(state)
  2903. state = not not state
  2904. if state ~= PlayerControl.featherfallEnabled then
  2905. PlayerControl.featherfallEnabled = state
  2906. if state then
  2907. Logger.print("Info", "Featherfall enabled in PlayerControl")
  2908. else
  2909. Logger.print("Info", "Featherfall disabled in PlayerControl")
  2910. end
  2911. end
  2912. end
  2913. function PlayerControl.SetPushable(state)
  2914. state = not not state
  2915. if state ~= PlayerControl.pushable then
  2916. PlayerControl.pushable = state
  2917. if state then
  2918. Logger.print("Info", "Pushing enabled in PlayerControl")
  2919. else
  2920. Logger.print("Info", "Pushing disabled in PlayerControl")
  2921. end
  2922. end
  2923. end
  2924. function PlayerControl.SetRolling(state)
  2925. state = not not state
  2926. if state ~= PlayerControl.rolling then
  2927. PlayerControl.rolling = state
  2928. if state then
  2929. Logger.print("Info", "Rolling fly mode enabled in PlayerControl")
  2930. else
  2931. Logger.print("Info", "Rolling fly mode disabled in PlayerControl")
  2932. end
  2933. end
  2934. end
  2935. function PlayerControl.StartFlying()
  2936. PlayerControl.fly_speed = PlayerControl.fly_basespeed
  2937. if torso then
  2938. flyingMomentum = torso.Velocity + torso.CFrame.lookVector * 3 + Vector3.new(0, 10, 0)
  2939. else
  2940. flyingMomentum = Vector3.new()
  2941. end
  2942. flyingTilt = 0
  2943. flying = true
  2944. end
  2945. function PlayerControl.StopFlying()
  2946. if bodyGyro.cframe then
  2947. local lookVector = bodyGyro.cframe.lookVector
  2948. if lookVector.X ~= 0 or lookVector.Z ~= 0 then
  2949. bodyGyro.cframe = CFrame.new(Vector3.new(), Vector3.new(lookVector.X, 0, lookVector.Z))
  2950. end
  2951. end
  2952. flying = false
  2953. end
  2954. local previousTime = 0
  2955. UserInterface.SetHotkey(" ", function()
  2956. if flying then
  2957. PlayerControl.StopFlying()
  2958. else
  2959. local currentTime = time()
  2960. if currentTime - previousTime < 0.4 then
  2961. previousTime = 0
  2962. PlayerControl.StartFlying()
  2963. else
  2964. previousTime = currentTime
  2965. end
  2966. end
  2967. end)
  2968. ]])
  2969. Module.Create("RBXInstance", [[
  2970. RBXInstance.init_metatable = {}
  2971. function RBXInstance.init_metatable:__call(data)
  2972. local instance = Instance.new(self[1])
  2973. for key, value in pairs(data) do
  2974. if type(key) == "number" then
  2975. value.Parent = instance
  2976. else
  2977. instance[key] = value
  2978. end
  2979. end
  2980. return instance
  2981. end
  2982. function RBXInstance.new(className)
  2983. return setmetatable({className}, RBXInstance.init_metatable)
  2984. end
  2985. ]])
  2986. Module.Create("AdvancedGUI", [=[
  2987. if not AdvancedGUI.GUI_BASE_COLOR then
  2988. AdvancedGUI.GUI_BASE_COLOR = Color3.new(0, 0, 0)
  2989. end
  2990. function AdvancedGUI.GenerateChatColor(speakerName)
  2991. local chatColor = ChatColor.Get(speakerName).Color
  2992. local brightness = chatColor.r + chatColor.g + chatColor.b
  2993. if brightness < 1.5 then
  2994. chatColor = Color3.new(math.min(1, 0.4 + chatColor.r), math.min(1, 0.4 + chatColor.g), math.min(1, 0.4 + chatColor.b))
  2995. else
  2996. chatColor = Color3.new(math.min(1, 0.05 + chatColor.r), math.min(1, 0.05 + chatColor.g), math.min(1, 0.05 + chatColor.b))
  2997. end
  2998. return chatColor
  2999. end
  3000. GuiBase = {}
  3001. GuiBase.__index = GuiBase
  3002. function GuiBase:new(data)
  3003. local instance = setmetatable({}, self)
  3004. instance:Init(data)
  3005. return instance
  3006. end
  3007. function GuiBase:Destroy()
  3008. if self.parent then
  3009. self.parent.children[self] = nil
  3010. end
  3011. for child in pairs(self.children) do
  3012. child:Destroy()
  3013. end
  3014. self.m_base_instance:Destroy()
  3015. end
  3016. function GuiBase:GetContentInstance(child)
  3017. return self.m_base_instance
  3018. end
  3019. function GuiBase:Init()
  3020. self.children = {}
  3021. end
  3022. function GuiBase:IsA(className)
  3023. return className == "GuiBase"
  3024. end
  3025. function GuiBase:SetParent(parent)
  3026. if parent ~= self.parent then
  3027. if self.parent then
  3028. self.parent.children[self] = nil
  3029. end
  3030. self.parent = parent
  3031. if parent then
  3032. parent.children[self] = true
  3033. self.m_base_instance.Parent = parent:GetContentInstance()
  3034. else
  3035. self.m_base_instance.Parent = nil
  3036. end
  3037. end
  3038. end
  3039. GuiObject = setmetatable({}, GuiBase)
  3040. GuiObject.__index = GuiObject
  3041. function GuiObject:Destroy()
  3042. self.DragBegin:disconnect()
  3043. self.DragMove:disconnect()
  3044. self.DragStopped:disconnect()
  3045. self.MouseButton1Click:disconnect()
  3046. self.MouseButton1Down:disconnect()
  3047. self.MouseButton1Up:disconnect()
  3048. self.MouseButton2Down:disconnect()
  3049. self.MouseButton2Up:disconnect()
  3050. self.MouseEnter:disconnect()
  3051. self.MouseLeave:disconnect()
  3052. GuiBase.Destroy(self)
  3053. end
  3054. function GuiObject:GetAbsolutePosition()
  3055. return self.m_base_instance.AbsolutePosition
  3056. end
  3057. function GuiObject:GetAbsoluteSize()
  3058. return self.m_base_instance.AbsoluteSize
  3059. end
  3060. function GuiObject:GetPosition()
  3061. return self.position
  3062. end
  3063. function GuiObject:GetSize()
  3064. return self.size
  3065. end
  3066. function GuiObject:Init()
  3067. GuiBase.Init(self)
  3068. self.mouseDown = false
  3069. self.mouseOver = false
  3070. self.DragBegin = RbxUtility.CreateSignal()
  3071. self.DragMove = RbxUtility.CreateSignal()
  3072. self.DragStopped = RbxUtility.CreateSignal()
  3073. self.MouseButton1Click = RbxUtility.CreateSignal()
  3074. self.MouseButton1Down = RbxUtility.CreateSignal()
  3075. self.MouseButton1Up = RbxUtility.CreateSignal()
  3076. self.MouseButton2Down = RbxUtility.CreateSignal()
  3077. self.MouseButton2Up = RbxUtility.CreateSignal()
  3078. self.MouseEnter = RbxUtility.CreateSignal()
  3079. self.MouseLeave = RbxUtility.CreateSignal()
  3080. end
  3081. function GuiObject:IsA(className)
  3082. return className == "GuiObject" or GuiBase.IsA(self, className)
  3083. end
  3084. function GuiObject:SetActive(active)
  3085. if active ~= self.active then
  3086. self.active = active
  3087. end
  3088. end
  3089. function GuiObject:SetBackgroundTransparency(backgroundTransparency)
  3090. if backgroundTransparency ~= self.backgroundTransparency then
  3091. self.backgroundTransparency = backgroundTransparency
  3092. self.m_base_instance.BackgroundTransparency = backgroundTransparency
  3093. end
  3094. end
  3095. function GuiObject:SetColor(color)
  3096. if color ~= self.color then
  3097. self.color = color
  3098. self.m_base_instance.BackgroundColor3 = color
  3099. end
  3100. end
  3101. function GuiObject:SetPosition(position)
  3102. if position ~= self.position then
  3103. self.position = position
  3104. self.m_base_instance.Position = position
  3105. end
  3106. end
  3107. function GuiObject:SetSize(size)
  3108. if size ~= self.size then
  3109. self.size = size
  3110. self.m_base_instance.Size = size
  3111. end
  3112. end
  3113. function GuiObject:SetVisible(visible)
  3114. if visible ~= self.visible then
  3115. self.visible = visible
  3116. self.m_base_instance.Visible = visible
  3117. end
  3118. end
  3119. function GuiObject:SetZIndex(zIndex)
  3120. local stack = {self.m_base_instance}
  3121. repeat
  3122. local object = stack[#stack]
  3123. stack[#stack] = nil
  3124. for _, child in ipairs(object:GetChildren()) do
  3125. stack[#stack + 1] = child
  3126. end
  3127. object.ZIndex = zIndex
  3128. until #stack == 0
  3129. end
  3130. GuiServiceClass = setmetatable({}, GuiBase)
  3131. GuiServiceClass.__index = GuiServiceClass
  3132. function GuiServiceClass:CreateTextArea(text, font, fontSize, textColor3, textXAlignment, textYAlignment, maxWidth, minWidth)
  3133. local totalHeight = 0
  3134. local frame = Instance.new("Frame")
  3135. frame.BackgroundTransparency = 1
  3136. local label = Instance.new("TextLabel")
  3137. label.BackgroundTransparency = 1
  3138. label.Font = font
  3139. label.FontSize = fontSize
  3140. label.TextColor3 = textColor3
  3141. label.TextTransparency = 1
  3142. label.TextWrapped = true
  3143. label.TextXAlignment = textXAlignment
  3144. label.TextYAlignment = textYAlignment
  3145. label.Parent = self.guiFrame
  3146. local index = 1
  3147. while true do
  3148. local length = #text - index + 1
  3149. if length > 1024 then
  3150. length = 1024
  3151. local textBlock = string.sub(text, index, index + length - 1)
  3152. label.Text = textBlock
  3153. local height = 0
  3154. local width = maxWidth
  3155. repeat
  3156. height = height + 20
  3157. label.Size = UDim2.new(0, width, 0, height)
  3158. until label.TextFits
  3159. repeat
  3160. height = height - 1
  3161. label.Size = UDim2.new(0, width, 0, height)
  3162. until not label.TextFits
  3163. repeat
  3164. length = length - 10
  3165. label.Text = string.sub(text, index, index + length - 1)
  3166. until label.TextFits
  3167. repeat
  3168. length = length + 1
  3169. label.Text = string.sub(text, index, index + length - 1)
  3170. until not label.TextFits
  3171. local overflowCharacter = string.sub(text, index + length - 1, index + length - 1)
  3172. length = length - 1
  3173. label.Text = string.sub(text, index, index + length - 1)
  3174. if overflowCharacter == "\n" then
  3175. index = index + 1
  3176. end
  3177. repeat
  3178. height = height - 1
  3179. label.Size = UDim2.new(0, width, 0, height)
  3180. until not label.TextFits
  3181. height = height + 1
  3182. local blockLabel = label:Clone()
  3183. blockLabel.Position = UDim2.new(0, 0, 0, totalHeight)
  3184. blockLabel.Size = UDim2.new(1, 0, 0, height)
  3185. blockLabel.Parent = frame
  3186. totalHeight = totalHeight + height
  3187. index = index + length
  3188. else
  3189. local textBlock = string.sub(text, index)
  3190. label.Text = textBlock
  3191. local height = 0
  3192. local width = maxWidth
  3193. repeat
  3194. height = height + 20
  3195. label.Size = UDim2.new(0, width, 0, height)
  3196. until label.TextFits
  3197. repeat
  3198. height = height - 1
  3199. label.Size = UDim2.new(0, width, 0, height)
  3200. until not label.TextFits
  3201. height = height + 1
  3202. if index == 1 then
  3203. repeat
  3204. width = width - 10
  3205. label.Size = UDim2.new(0, width, 0, height)
  3206. until width < minWidth or not label.TextFits
  3207. width = math.max(width, minWidth - 1)
  3208. repeat
  3209. width = width + 1
  3210. label.Size = UDim2.new(0, width, 0, height)
  3211. until label.TextFits
  3212. end
  3213. local blockLabel = label:Clone()
  3214. blockLabel.Position = UDim2.new(0, 0, 0, totalHeight)
  3215. blockLabel.Size = UDim2.new(1, 0, 0, height)
  3216. blockLabel.Parent = frame
  3217. label:Destroy()
  3218. frame.Size = UDim2.new(0, width, 0, totalHeight + height)
  3219. return frame
  3220. end
  3221. end
  3222. end
  3223. function GuiServiceClass:Destroy()
  3224. self.running = false
  3225. self.cameraPart:Destroy()
  3226. self.cameraConnection:disconnect()
  3227. self.keyDownConnection:disconnect()
  3228. self.mouseButton1DownConnection:disconnect()
  3229. self.mouseButton1UpConnection:disconnect()
  3230. self.mouseButton2DownConnection:disconnect()
  3231. self.mouseButton2UpConnection:disconnect()
  3232. self.mouseMoveConnection:disconnect()
  3233. self.steppedConnection:disconnect()
  3234. end
  3235. function GuiServiceClass:GetMousePosition()
  3236. local mouse = self.mouse
  3237. return mouse.X, mouse.Y -- mouse.X, mouse.Y + 2 -- return mouse.X - 2, mouse.Y - 3
  3238. end
  3239. function GuiServiceClass:GetTextBounds(text, font, fontSize, alignX, alignY, width)
  3240. local tempLabel = self.tempLabel
  3241. tempLabel.Font = font
  3242. tempLabel.FontSize = fontSize
  3243. tempLabel.Size = UDim2.new(0, width, 0, 4096)
  3244. tempLabel.Text = text
  3245. tempLabel.TextXAlignment = alignX
  3246. tempLabel.TextYAlignment = alignY
  3247. local textBounds = tempLabel.TextBounds
  3248. tempLabel.Text = ""
  3249. return textBounds
  3250. end
  3251. function GuiServiceClass:Init(data)
  3252. GuiBase.Init(self)
  3253. local _ = string.char
  3254. local camera = data.Camera
  3255. local mouse = data.Mouse
  3256. local cameraPart = Instance.new("Part")
  3257. local billboardGui = Instance.new("BillboardGui", cameraPart)
  3258. guiFrame = Instance.new("Frame", billboardGui)
  3259. cameraPart.Anchored = true
  3260. cameraPart.BottomSurface = "Smooth"
  3261. cameraPart.CanCollide = false
  3262. -- cameraPart.CFrame = CFrame.new(16384, 16384, 16384)
  3263. cameraPart.FormFactor = "Custom"
  3264. cameraPart.Locked = true
  3265. cameraPart.Size = Vector3.new(0.2, 0.2, 0.2)
  3266. cameraPart.TopSurface = "Smooth"
  3267. cameraPart.Transparency = 1
  3268. billboardGui.Adornee = cameraPart
  3269. billboardGui.AlwaysOnTop = true
  3270. -- billboardGui.ExtentsOffset = Vector3.new(-16384, -16384, -16384)
  3271. guiFrame.BackgroundTransparency = 1
  3272. cameraPart.Parent = camera
  3273. self.running = true
  3274. self.m_base_instance = guiFrame
  3275. self.billboardGui = billboardGui
  3276. self.cameraPart = cameraPart
  3277. self.tempLabel = RBXInstance.new "TextLabel" {
  3278. BackgroundTransparency = 1,
  3279. TextTransparency = 1,
  3280. TextWrapped = true,
  3281. Parent = guiFrame
  3282. }
  3283. self.mnemonics = {}
  3284. self.visible = true
  3285. self.camera = camera
  3286. self.mouse = mouse
  3287. self.cameraConnection = camera.Changed:connect(function(property)
  3288. self:UpdateView()
  3289. if property == "CameraType" then
  3290. if camera.CameraType ~= Enum.CameraType.Track and camera.CameraType ~= Enum.CameraType.Fixed then
  3291. camera.CameraType = Enum.CameraType.Track
  3292. end
  3293. elseif property == "CoordinateFrame" and camera.CameraType ~= Enum.CameraType.Fixed then
  3294. local cframe, focus = camera.CoordinateFrame, camera.Focus
  3295. local watchOffset = focus.p - cframe.p
  3296. local error = watchOffset.unit - cframe.lookVector
  3297. if error.magnitude >= 1e-3 then
  3298. local head = PlayerControl.GetHead()
  3299. local time1, velocity1
  3300. if head then
  3301. time1 = time()
  3302. velocity1 = head.Velocity
  3303. end
  3304. if camera.Changed:wait() == "CoordinateFrame" then
  3305. local position = cframe.p
  3306. if head then
  3307. local time2 = time()
  3308. local velocity2 = head.Velocity
  3309. position = position + 0.5 * (velocity1 + velocity2) * (time2 - time1)
  3310. end
  3311. camera.CoordinateFrame = CFrame.new(position, camera.Focus.p)
  3312. end
  3313. end
  3314. end
  3315. end)
  3316. self.keyDownConnection = mouse.KeyDown:connect(function(key) self:KeyDown(key) end)
  3317. self.mouseButton1DownConnection = mouse.Button1Down:connect(function() self:MouseButton1Down() end)
  3318. self.mouseButton1UpConnection = mouse.Button1Up:connect(function() self:MouseButton1Up() end)
  3319. self.mouseButton2DownConnection = mouse.Button2Down:connect(function() self:MouseButton2Down() end)
  3320. self.mouseButton2UpConnection = mouse.Button2Up:connect(function() self:MouseButton2Up() end)
  3321. self.mouseMoveConnection = mouse.Move:connect(function() self:MouseMove() end)
  3322. self.steppedConnection = RunService.RenderStepped:connect(function() self:UpdateObjects() self:UpdateView() end)
  3323. self.mousePreviousPosition = Vector2.new(self:GetMousePosition())
  3324. end
  3325. function GuiServiceClass:IsA(className)
  3326. return className == "GuiService" or GuiBase.IsA(self, className)
  3327. end
  3328. function GuiServiceClass:KeyDown(key)
  3329. local mnemonicButton = self.mnemonics[string.upper(key)]
  3330. if mnemonicButton then
  3331. mnemonicButton.Activated:fire()
  3332. end
  3333. end
  3334. function GuiServiceClass:MouseButton1Down()
  3335. local mouse = self.mouse
  3336. local mouseX, mouseY = self:GetMousePosition()
  3337. local stack = {self}
  3338. local dragObjects = {}
  3339. self.dragObjects = dragObjects
  3340. while #stack > 0 do
  3341. local object = stack[#stack]
  3342. stack[#stack] = nil
  3343. if object.visible then
  3344. for child in pairs(object.children) do
  3345. stack[#stack + 1] = child
  3346. end
  3347. if object.active then
  3348. local position = object:GetAbsolutePosition()
  3349. local size = object:GetAbsoluteSize()
  3350. if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then
  3351. object.mouseDown = true
  3352. dragObjects[object] = true
  3353. local mouseButton1Down = object.MouseButton1Down
  3354. if mouseButton1Down then
  3355. mouseButton1Down:fire()
  3356. if object.autoButtonColor then
  3357. local color = object.color
  3358. local transparency = object.backgroundTransparency
  3359. object.m_base_instance.BackgroundColor3 = Color3.new(math.min(color.r + 0.3, 1), math.min(color.g +
  3360.  
  3361. 0.3, 1), math.min(color.b + 0.3, 1))
  3362. object.m_base_instance.BackgroundTransparency = transparency
  3363. end
  3364. end
  3365. object.DragBegin:fire()
  3366. end
  3367. end
  3368. end
  3369. end
  3370. self.mousePreviousPosition = Vector2.new(mouseX, mouseY)
  3371. end
  3372. function GuiServiceClass:MouseButton1Up()
  3373. local mouse = self.mouse
  3374. local mouseX, mouseY = self:GetMousePosition()
  3375. local stack = {self}
  3376. while #stack > 0 do
  3377. local object = stack[#stack]
  3378. stack[#stack] = nil
  3379. if object.visible then
  3380. for child in pairs(object.children) do
  3381. stack[#stack + 1] = child
  3382. end
  3383. if object.active then
  3384. local position = object:GetAbsolutePosition()
  3385. local size = object:GetAbsoluteSize()
  3386. if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then
  3387. object.MouseButton1Up:fire()
  3388. end
  3389. end
  3390. end
  3391. end
  3392. local dragObjects = self.dragObjects
  3393. self.dragObjects = nil
  3394. if dragObjects then
  3395. for dragObject in pairs(dragObjects) do
  3396. dragObject.mouseDown = false
  3397. local position = dragObject:GetAbsolutePosition()
  3398. local size = dragObject:GetAbsoluteSize()
  3399. if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then
  3400. dragObject.MouseButton1Click:fire()
  3401. local activated = dragObject.Activated
  3402. if activated then
  3403. activated:fire()
  3404. end
  3405. end
  3406. dragObject.DragStopped:fire()
  3407. if dragObject.autoButtonColor then
  3408. if dragObject.mouseOver then
  3409. local color = dragObject.color
  3410. local transparency = dragObject.backgroundTransparency
  3411. dragObject.m_base_instance.BackgroundColor3 = Color3.new(math.max(color.r - 0.3, 0), math.max(color.g - 0.3, 0),
  3412.  
  3413. math.max(color.b - 0.3, 0))
  3414. dragObject.m_base_instance.BackgroundTransparency = math.max(0, transparency - 0.2)
  3415. else
  3416. dragObject.m_base_instance.BackgroundColor3 = dragObject.color
  3417. dragObject.m_base_instance.BackgroundTransparency = dragObject.backgroundTransparency
  3418. end
  3419. end
  3420. self.dragObject = nil
  3421. end
  3422. end
  3423. end
  3424. function GuiServiceClass:MouseButton2Down()
  3425. local mouse = self.mouse
  3426. local mouseX, mouseY = self:GetMousePosition()
  3427. local stack = {self}
  3428. while #stack > 0 do
  3429. local object = stack[#stack]
  3430. stack[#stack] = nil
  3431. if object.visible then
  3432. for child in pairs(object.children) do
  3433. stack[#stack + 1] = child
  3434. end
  3435. if object.active then
  3436. local position = object:GetAbsolutePosition()
  3437. local size = object:GetAbsoluteSize()
  3438. if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then
  3439. local mouseButton2Down = object.MouseButton2Down
  3440. if mouseButton2Down then
  3441. mouseButton2Down:fire()
  3442. end
  3443. end
  3444. end
  3445. end
  3446. end
  3447. self.mousePreviousPosition = Vector2.new(mouseX, mouseY)
  3448. end
  3449. function GuiServiceClass:MouseButton2Up()
  3450. local mouse = self.mouse
  3451. local mouseX, mouseY = self:GetMousePosition()
  3452. local stack = {self}
  3453. while #stack > 0 do
  3454. local object = stack[#stack]
  3455. stack[#stack] = nil
  3456. if object.visible then
  3457. for child in pairs(object.children) do
  3458. stack[#stack + 1] = child
  3459. end
  3460. if object.active then
  3461. local position = object:GetAbsolutePosition()
  3462. local size = object:GetAbsoluteSize()
  3463. if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then
  3464. local mouseButton2Up = object.MouseButton2Up
  3465. if mouseButton2Up then
  3466. mouseButton2Up:fire()
  3467. end
  3468. end
  3469. end
  3470. end
  3471. end
  3472. end
  3473. function GuiServiceClass:MouseMove()
  3474. self:UpdateObjects()
  3475. local dragObjects = self.dragObjects
  3476. if dragObjects then
  3477. for dragObject in pairs(dragObjects) do
  3478. local mouse = self.mouse
  3479. local mousePosition = Vector2.new(self:GetMousePosition())
  3480. dragObject.DragMove:fire(mousePosition - self.mousePreviousPosition)
  3481. self.mousePreviousPosition = mousePosition
  3482. end
  3483. end
  3484. end
  3485. function GuiServiceClass:SetMnemonic(mnemonic, button)
  3486. self.mnemonics[mnemonic] = button
  3487. end
  3488. function GuiServiceClass:UpdateObjects()
  3489. local mouse = self.mouse
  3490. local mouseX, mouseY = self:GetMousePosition()
  3491. local stack = {self}
  3492. while #stack > 0 do
  3493. local object = stack[#stack]
  3494. stack[#stack] = nil
  3495. if object.visible then
  3496. for child in pairs(object.children) do
  3497. stack[#stack + 1] = child
  3498. end
  3499. if object.active then
  3500. local position = object:GetAbsolutePosition()
  3501. local size = object:GetAbsoluteSize()
  3502. if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then
  3503. if not object.mouseOver then
  3504. object.mouseOver = true
  3505. object.MouseEnter:fire()
  3506. if object.autoButtonColor then
  3507. local color = object.color
  3508. local transparency = object.backgroundTransparency
  3509. if object.mouseDown then
  3510. object.m_base_instance.BackgroundColor3 = Color3.new(math.min(color.r + 0.3, 1), math.min
  3511.  
  3512. (color.g + 0.3, 1), math.min(color.b + 0.3, 1))
  3513. object.m_base_instance.BackgroundTransparency = transparency
  3514. else
  3515. object.m_base_instance.BackgroundColor3 = Color3.new(math.max(color.r - 0.3, 0), math.max
  3516.  
  3517. (color.g - 0.3, 0), math.max(color.b - 0.3, 0))
  3518. object.m_base_instance.BackgroundTransparency = math.max(0, transparency - 0.2)
  3519. end
  3520. end
  3521. end
  3522. else
  3523. if object.mouseOver then
  3524. object.mouseOver = false
  3525. object.MouseLeave:fire()
  3526. if object.autoButtonColor then
  3527. object.m_base_instance.BackgroundColor3 = object.color
  3528. object.m_base_instance.BackgroundTransparency = object.backgroundTransparency
  3529. end
  3530. end
  3531. end
  3532. end
  3533. end
  3534. end
  3535. end
  3536. function GuiServiceClass:UpdateView()
  3537. local billboardGui = self.billboardGui
  3538. local guiFrame = self.m_base_instance
  3539. local camera = self.camera
  3540. local mouse = self.mouse
  3541. local cameraCFrame = CFrame.new(camera.CoordinateFrame.p, camera.Focus.p) -- camera.CoordinateFrame
  3542. local viewSizeX, viewSizeY = mouse.ViewSizeX, mouse.ViewSizeY
  3543. local previousViewSize = self.viewSize
  3544. if not previousViewSize or ((viewSizeX ~= 0 or viewSizeY ~= 0) and (viewSizeX ~= previousViewSize.X or viewSizeY ~= previousViewSize.Y)) then
  3545. self.viewSize = {X = viewSizeX, Y = viewSizeY}
  3546. local viewSizeUDim2 = UDim2.new(0, viewSizeX, 0, viewSizeY)
  3547. billboardGui.Size = viewSizeUDim2
  3548. guiFrame.Size = viewSizeUDim2
  3549. -- FIXME:
  3550. -- After the 15th of July 2014, there came an offset at the Y thingy out of nowhere so I accomodated for that.
  3551. billboardGui.SizeOffset = Vector2.new(0.5 / viewSizeX, (0.5 + 10) / viewSizeY)
  3552. end
  3553. --billboardGui.SizeOffset = Vector2.new()
  3554. billboardGui.StudsOffset = (cameraCFrame - cameraCFrame.p):inverse() * cameraCFrame.p - Vector3.new(0, 0, 1)
  3555. end
  3556. GuiService = GuiServiceClass:new {
  3557. Camera = Camera,
  3558. Mouse = Mouse
  3559. }
  3560. GuiFrame = setmetatable({}, GuiObject)
  3561. GuiFrame.__index = GuiFrame
  3562. GuiFrame.__default = {__index = {
  3563. Active = false,
  3564. BackgroundTransparency = 0.75,
  3565. BorderSize = 4,
  3566. BorderTransparency = 0.75,
  3567. Color = AdvancedGUI.GUI_BASE_COLOR,
  3568. Position = UDim2.new(0, 0, 0, 0),
  3569. Size = UDim2.new(0, 52, 0, 52),
  3570. Visible = true
  3571. }}
  3572. function GuiFrame:Destroy()
  3573. GuiObject.Destroy(self)
  3574. end
  3575. function GuiFrame:GetContentInstance()
  3576. return self.m_content_frame
  3577. end
  3578. function GuiFrame:Init(data)
  3579. GuiObject.Init(self)
  3580. setmetatable(data, GuiFrame.__default)
  3581. local leftBorderFrameLeft = RBXInstance.new "Frame" {
  3582. BackgroundColor3 = Color3.new(0, 0, 0),
  3583. BorderSizePixel = 0,
  3584. Size = UDim2.new(0, 1, 1, -1)
  3585. }
  3586. local leftBorderFrameCenter = RBXInstance.new "Frame" {
  3587. BackgroundColor3 = Color3.new(1, 1, 1),
  3588. BorderSizePixel = 0,
  3589. Position = UDim2.new(0, 1, 0, 1)
  3590. }
  3591. local leftBorderFrameRight = RBXInstance.new "Frame" {
  3592. BackgroundColor3 = Color3.new(0, 0, 0),
  3593. BorderSizePixel = 0
  3594. }
  3595. local rightBorderFrameRight = RBXInstance.new "Frame" {
  3596. BackgroundColor3 = Color3.new(0, 0, 0),
  3597. BorderSizePixel = 0,
  3598. Position = UDim2.new(1, -1, 0, 1),
  3599. Size = UDim2.new(0, 1, 1, -1)
  3600. }
  3601. local rightBorderFrameCenter = RBXInstance.new "Frame" {
  3602. BackgroundColor3 = Color3.new(1, 1, 1),
  3603. BorderSizePixel = 0
  3604. }
  3605. local rightBorderFrameLeft = RBXInstance.new "Frame" {
  3606. BackgroundColor3 = Color3.new(0, 0, 0),
  3607. BorderSizePixel = 0
  3608. }
  3609. local bottomBorderFrameBottom = RBXInstance.new "Frame" {
  3610. BackgroundColor3 = Color3.new(0, 0, 0),
  3611. BorderSizePixel = 0,
  3612. Position = UDim2.new(0, 0, 1, -1),
  3613. Size = UDim2.new(1, -1, 0, 1)
  3614. }
  3615. local bottomBorderFrameCenter = RBXInstance.new "Frame" {
  3616. BackgroundColor3 = Color3.new(1, 1, 1),
  3617. BorderSizePixel = 0
  3618. }
  3619. local bottomBorderFrameTop = RBXInstance.new "Frame" {
  3620. BackgroundColor3 = Color3.new(0, 0, 0),
  3621. BorderSizePixel = 0
  3622. }
  3623. local topBorderFrameTop = RBXInstance.new "Frame" {
  3624. BackgroundColor3 = Color3.new(0, 0, 0),
  3625. BorderSizePixel = 0,
  3626. Position = UDim2.new(0, 1, 0, 0),
  3627. Size = UDim2.new(1, -1, 0, 1)
  3628. }
  3629. local topBorderFrameCenter = RBXInstance.new "Frame" {
  3630. BackgroundColor3 = Color3.new(1, 1, 1),
  3631. BorderSizePixel = 0
  3632. }
  3633. local topBorderFrameBottom = RBXInstance.new "Frame" {
  3634. BackgroundColor3 = Color3.new(0, 0, 0),
  3635. BorderSizePixel = 0
  3636. }
  3637. local border_frame = RBXInstance.new "Frame" {
  3638. BackgroundTransparency = 1,
  3639. Size = UDim2.new(1, 0, 1, 0),
  3640. leftBorderFrameLeft,
  3641. leftBorderFrameCenter,
  3642. leftBorderFrameRight,
  3643. rightBorderFrameLeft,
  3644. rightBorderFrameCenter,
  3645. rightBorderFrameRight,
  3646. bottomBorderFrameBottom,
  3647. bottomBorderFrameCenter,
  3648. bottomBorderFrameTop,
  3649. topBorderFrameBottom,
  3650. topBorderFrameCenter,
  3651. topBorderFrameTop
  3652. }
  3653. local contentFrame = RBXInstance.new "Frame" {
  3654. BackgroundTransparency = 1,
  3655. BorderSizePixel = 0,
  3656. ClipsDescendants = true,
  3657. Size = UDim2.new(1, 0, 1, 0)
  3658. }
  3659. local base_frame = RBXInstance.new "Frame" {
  3660. BorderSizePixel = 0,
  3661. border_frame,
  3662. contentFrame
  3663. }
  3664. self.m_base_instance = base_frame
  3665. self.m_content_frame = contentFrame
  3666. self.m_border_frame = border_frame
  3667. self.leftBorderFrameLeft = leftBorderFrameLeft
  3668. self.leftBorderFrameCenter = leftBorderFrameCenter
  3669. self.leftBorderFrameRight = leftBorderFrameRight
  3670. self.rightBorderFrameLeft = rightBorderFrameLeft
  3671. self.rightBorderFrameCenter = rightBorderFrameCenter
  3672. self.rightBorderFrameRight = rightBorderFrameRight
  3673. self.bottomBorderFrameBottom = bottomBorderFrameBottom
  3674. self.bottomBorderFrameCenter = bottomBorderFrameCenter
  3675. self.bottomBorderFrameTop = bottomBorderFrameTop
  3676. self.topBorderFrameBottom = topBorderFrameBottom
  3677. self.topBorderFrameCenter = topBorderFrameCenter
  3678. self.topBorderFrameTop = topBorderFrameTop
  3679. self:SetActive(data.Active)
  3680. self:SetBackgroundTransparency(data.BackgroundTransparency)
  3681. self:SetBorderSize(data.BorderSize)
  3682. self:SetBorderTransparency(data.BorderTransparency)
  3683. self:SetColor(data.Color)
  3684. self:SetPosition(data.Position)
  3685. self:SetSize(data.Size)
  3686. self:SetVisible(data.Visible)
  3687. self:SetParent(data.Parent)
  3688. end
  3689. function GuiFrame:IsA(className)
  3690. return className == "GuiFrame" or GuiObject.IsA(self, className)
  3691. end
  3692. function GuiFrame:SetBorderSize(border_size)
  3693. border_size = math.max(math.floor(border_size + 0.5), 0)
  3694. if border_size ~= self.m_border_size then
  3695. self.m_border_size = border_size
  3696. local border_frame = self.m_border_frame
  3697. local contentFrame = self.m_content_frame
  3698. local leftBorderFrameCenter = self.leftBorderFrameCenter
  3699. local leftBorderFrameRight = self.leftBorderFrameRight
  3700. local rightBorderFrameCenter = self.rightBorderFrameCenter
  3701. local rightBorderFrameLeft = self.rightBorderFrameLeft
  3702. local bottomBorderFrameCenter = self.bottomBorderFrameCenter
  3703. local bottomBorderFrameTop = self.bottomBorderFrameTop
  3704. local topBorderFrameCenter = self.topBorderFrameCenter
  3705. local topBorderFrameBottom = self.topBorderFrameBottom
  3706. contentFrame.Position = UDim2.new(0, border_size, 0, border_size)
  3707. contentFrame.Size = UDim2.new(1, -2 * border_size, 1, -2 * border_size)
  3708. local inner_visible = border_size > 0
  3709. if self.leftBorderFrameLeft.Visible ~= inner_visible then
  3710. self.rightBorderFrameRight.Visible = inner_visible
  3711. self.bottomBorderFrameBottom.Visible = inner_visible
  3712. self.topBorderFrameTop.Visible = inner_visible
  3713. end
  3714. local outer_visible = border_size > 1
  3715. if leftBorderFrameCenter.Visible ~= outer_visible then
  3716. leftBorderFrameCenter.Visible = outer_visible
  3717. leftBorderFrameRight.Visible = outer_visible
  3718. rightBorderFrameCenter.Visible = outer_visible
  3719. rightBorderFrameLeft.Visible = outer_visible
  3720. bottomBorderFrameCenter.Visible = outer_visible
  3721. bottomBorderFrameTop.Visible = outer_visible
  3722. topBorderFrameCenter.Visible = outer_visible
  3723. topBorderFrameBottom.Visible = outer_visible
  3724. end
  3725. if outer_visible then
  3726. leftBorderFrameCenter.Size = UDim2.new(0, border_size - 2, 1, -border_size)
  3727. leftBorderFrameRight.Position = UDim2.new(0, border_size - 1, 0, border_size - 1)
  3728. leftBorderFrameRight.Size = UDim2.new(0, 1, 1, 1 - 2 * border_size)
  3729. rightBorderFrameCenter.Position = UDim2.new(1, 1 - border_size, 0, border_size - 1)
  3730. rightBorderFrameCenter.Size = UDim2.new(0, border_size - 2, 1, -border_size)
  3731. rightBorderFrameLeft.Position = UDim2.new(1, -border_size, 0, border_size)
  3732. rightBorderFrameLeft.Size = UDim2.new(0, 1, 1, 1 - 2 * border_size)
  3733. bottomBorderFrameCenter.Position = UDim2.new(0, 1, 1, 1 - border_size)
  3734. bottomBorderFrameCenter.Size = UDim2.new(1, -border_size, 0, border_size - 2)
  3735. bottomBorderFrameTop.Position = UDim2.new(0, border_size - 1, 1, -border_size)
  3736. bottomBorderFrameTop.Size = UDim2.new(1, 1 - 2 * border_size, 0, 1)
  3737. topBorderFrameCenter.Position = UDim2.new(0, border_size - 1, 0, 1)
  3738. topBorderFrameCenter.Size = UDim2.new(1, -border_size, 0, border_size - 2)
  3739. topBorderFrameBottom.Position = UDim2.new(0, border_size, 0, border_size - 1)
  3740. topBorderFrameBottom.Size = UDim2.new(1, 1 - 2 * border_size, 0, 1)
  3741. end
  3742. end
  3743. end
  3744. function GuiFrame:SetBorderTransparency(borderTransparency)
  3745. self.borderTransparency = borderTransparency
  3746. self.leftBorderFrameLeft.BackgroundTransparency = borderTransparency
  3747. self.leftBorderFrameCenter.BackgroundTransparency = borderTransparency
  3748. self.leftBorderFrameRight.BackgroundTransparency = borderTransparency
  3749. self.rightBorderFrameLeft.BackgroundTransparency = borderTransparency
  3750. self.rightBorderFrameCenter.BackgroundTransparency = borderTransparency
  3751. self.rightBorderFrameRight.BackgroundTransparency = borderTransparency
  3752. self.bottomBorderFrameBottom.BackgroundTransparency = borderTransparency
  3753. self.bottomBorderFrameCenter.BackgroundTransparency = borderTransparency
  3754. self.bottomBorderFrameTop.BackgroundTransparency = borderTransparency
  3755. self.topBorderFrameBottom.BackgroundTransparency = borderTransparency
  3756. self.topBorderFrameCenter.BackgroundTransparency = borderTransparency
  3757. self.topBorderFrameTop.BackgroundTransparency = borderTransparency
  3758. end
  3759. GuiButton = setmetatable({}, GuiFrame)
  3760. GuiButton.__index = GuiButton
  3761. GuiButton.__default = {__index = {
  3762. AutoButtonColor = true
  3763. }}
  3764. function GuiButton:Destroy()
  3765. self.Activated:disconnect()
  3766. GuiFrame.Destroy(self)
  3767. end
  3768. function GuiButton:Init(data)
  3769. if data.Active == nil then
  3770. data.Active = true
  3771. end
  3772. GuiFrame.Init(self, data)
  3773. setmetatable(data, GuiButton.__default)
  3774. self.Activated = RbxUtility.CreateSignal()
  3775. self:SetAutoButtonColor(data.AutoButtonColor)
  3776. end
  3777. function GuiButton:IsA(className)
  3778. return className == "GuiButton" or GuiFrame.IsA(self, className)
  3779. end
  3780. function GuiButton:SetAutoButtonColor(autoButtonColor)
  3781. if autoButtonColor ~= self.autoButtonColor then
  3782. self.autoButtonColor = autoButtonColor
  3783. if autoButtonColor then
  3784. if self.mouseOver then
  3785. local color = self.color
  3786. local transparency = self.backgroundTransparency
  3787. if self.mouseDown then
  3788. self.m_base_instance.BackgroundColor3 = Color3.new(math.min(color.r + 0.3, 1), math.min(color.g + 0.3, 1), math.min
  3789.  
  3790. (color.b + 0.3, 1))
  3791. self.m_base_instance.BackgroundTransparency = transparency
  3792. else
  3793. self.m_base_instance.BackgroundColor3 = Color3.new(math.max(color.r - 0.3, 0), math.max(color.g - 0.3, 0), math.max
  3794.  
  3795. (color.b - 0.3, 0))
  3796. self.m_base_instance.BackgroundTransparency = math.max(0, transparency - 0.5)
  3797. end
  3798. end
  3799. else
  3800. self.m_base_instance.BackgroundColor3 = self.color
  3801. end
  3802. end
  3803. end
  3804. GuiTextLabel = setmetatable({}, GuiFrame)
  3805. GuiTextLabel.__index = GuiTextLabel
  3806. GuiTextLabel.__default = {__index = {
  3807. Font = "ArialBold",
  3808. FontSize = "Size12",
  3809. Text = "",
  3810. TextColor = Color3.new(1, 1, 1),
  3811. TextStrokeColor = Color3.new(0, 0, 0),
  3812. TextStrokeTransparency = 0.6,
  3813. TextWrapped = true
  3814. }}
  3815. function GuiTextLabel:Destroy()
  3816. GuiFrame.Destroy(self)
  3817. end
  3818. function GuiTextLabel:Init(data)
  3819. GuiFrame.Init(self, data)
  3820. setmetatable(data, GuiTextLabel.__default)
  3821. local base_instance = self.m_base_instance
  3822. local textLabel = RBXInstance.new "TextLabel" {
  3823. BackgroundTransparency = 1,
  3824. Font = data.Font,
  3825. FontSize = data.FontSize,
  3826. TextColor3 = data.TextColor3,
  3827. TextStrokeColor3 = data.TextStrokeColor3,
  3828. TextStrokeTransparency = data.TextStrokeTransparency,
  3829. TextWrapped = data.TextWrapped
  3830. }
  3831. textLabel.Parent = self:GetContentInstance()
  3832. self.textLabel = textLabel
  3833. self:SetText(data.Text)
  3834. end
  3835. function GuiTextLabel:IsA(className)
  3836. return className == "GuiTextLabel" or GuiFrame.IsA(self, className)
  3837. end
  3838. function GuiTextLabel:SetText(text)
  3839. if text ~= self.text then
  3840. self.text = text
  3841. local text_index = 1
  3842. local content_instance = self:GetContentInstance()
  3843. local content_instance_size = content_instance.AbsoluteSize
  3844. local frame = Instance.new("Frame")
  3845. frame.BackgroundTransparency = 1
  3846. local label = Instance.new("TextLabel")
  3847. label.BackgroundTransparency = 1
  3848. label.Font = font
  3849. label.FontSize = fontSize
  3850. label.Size = UDim2.new(0, content_instance_size.X, 0, 1000)
  3851. label.Text = ""
  3852. label.TextColor3 = textColor3
  3853. label.TextTransparency = 1
  3854. label.TextWrapped = true
  3855. label.TextXAlignment = textXAlignment
  3856. label.TextYAlignment = textYAlignment
  3857. label.Parent = self.guiFrame
  3858. local row_length = 0
  3859. local step_size = 256
  3860. for step = 1, 8 do
  3861. step_size = 0.5 * step_size
  3862. label.Text = string.sub(text, text_index, text_index + row_length - 1)
  3863. end
  3864. end
  3865. end
  3866. GuiImageButton = setmetatable({}, GuiButton)
  3867. GuiImageButton.__index = GuiImageButton
  3868. GuiImageButton.__default = {__index = {
  3869. Image = ""
  3870. }}
  3871. function GuiImageButton:Destroy()
  3872. GuiButton.Destroy(self)
  3873. end
  3874. function GuiImageButton:Init(data)
  3875. GuiButton.Init(self, data)
  3876. setmetatable(data, GuiImageButton.__default)
  3877. local content_frame = self.m_content_frame
  3878. local image_label = RBXInstance.new "ImageLabel" {
  3879. BackgroundTransparency = 1,
  3880. Size = UDim2.new(1, 0, 1, 0)
  3881. }
  3882. image_label.Parent = content_frame
  3883. self.m_image_label = image_label
  3884. self:SetImage(data.Image)
  3885. end
  3886. function GuiImageButton:IsA(className)
  3887. return className == "GuiImageButton" or GuiButton.IsA(self, className)
  3888. end
  3889. function GuiImageButton:SetImage(image)
  3890. if image ~= self.m_image then
  3891. self.m_image = image
  3892. self.m_image_label.Image = image
  3893. end
  3894. end
  3895. GuiTextButton = setmetatable({}, GuiButton)
  3896. GuiTextButton.__index = GuiTextButton
  3897. GuiTextButton.__default = {__index = {
  3898. Font = Enum.Font.ArialBold,
  3899. FontSize = Enum.FontSize.Size11,
  3900. Text = "Button",
  3901. TextXAlignment = Enum.TextXAlignment.Center
  3902. }}
  3903. function GuiTextButton:Destroy()
  3904. GuiButton.Destroy(self)
  3905. end
  3906. function GuiTextButton:GetTextBounds()
  3907. return self.textLabel.TextBounds
  3908. end
  3909. function GuiTextButton:Init(data)
  3910. GuiButton.Init(self, data)
  3911. setmetatable(data, GuiTextButton.__default)
  3912. local contentFrame = self.m_content_frame
  3913. local mnemonicLabel = RBXInstance.new "TextLabel" {
  3914. BackgroundTransparency = 1,
  3915. Font = "ArialBold",
  3916. FontSize = "Size36",
  3917. Size = UDim2.new(1, 0, 0.7, 0),
  3918. TextColor3 = Color3.new(1, 1, 1),
  3919. TextStrokeColor3 = Color3.new(0, 0, 0),
  3920. TextStrokeTransparency = 0.6,
  3921. TextWrapped = true
  3922. }
  3923. local textLabel = RBXInstance.new "TextLabel" {
  3924. BackgroundTransparency = 1,
  3925. TextColor3 = Color3.new(1, 1, 1),
  3926. TextStrokeColor3 = Color3.new(0, 0, 0),
  3927. TextStrokeTransparency = 0.6,
  3928. TextWrapped = true
  3929. }
  3930. mnemonicLabel.Parent = contentFrame
  3931. textLabel.Parent = contentFrame
  3932. self.mnemonicLabel = mnemonicLabel
  3933. self.textLabel = textLabel
  3934. self:SetFont(data.Font)
  3935. self:SetFontSize(data.FontSize)
  3936. self:SetMnemonic(data.Mnemonic, true)
  3937. self:SetText(data.Text)
  3938. self:SetTextXAlignment(data.TextXAlignment)
  3939. end
  3940. function GuiTextButton:IsA(className)
  3941. return className == "GuiTextButton" or GuiButton.IsA(self, className)
  3942. end
  3943. function GuiTextButton:SetFont(font)
  3944. if font ~= self.font then
  3945. self.font = font
  3946. self.textLabel.Font = font
  3947. end
  3948. end
  3949. function GuiTextButton:SetFontSize(fontSize)
  3950. if fontSize ~= self.fontSize then
  3951. self.fontSize = fontSize
  3952. self.textLabel.FontSize = fontSize
  3953. end
  3954. end
  3955. function GuiTextButton:SetMnemonic(mnemonic, forceUpdate)
  3956. if mnemonic ~= self.mnemonic or forceUpdate then
  3957. if self.mnemonic then
  3958. GuiService:SetMnemonic(self.mnemonic, nil)
  3959. end
  3960. if mnemonic then
  3961. GuiService:SetMnemonic(mnemonic, self)
  3962. end
  3963. self.mnemonic = mnemonic
  3964. local mnemonicLabel = self.mnemonicLabel
  3965. local textLabel = self.textLabel
  3966. if mnemonic then
  3967. mnemonicLabel.Text = mnemonic
  3968. textLabel.Size = UDim2.new(1, 0, 0.9, 0)
  3969. textLabel.TextYAlignment = "Bottom"
  3970. else
  3971. mnemonicLabel.Text = ""
  3972. textLabel.Size = UDim2.new(1, 0, 1, 0)
  3973. textLabel.TextYAlignment = "Center"
  3974. end
  3975. end
  3976. end
  3977. function GuiTextButton:SetText(text)
  3978. if text ~= self.text then
  3979. self.text = text
  3980. self.textLabel.Text = text
  3981. end
  3982. end
  3983. function GuiTextButton:SetTextXAlignment(textXAlignment)
  3984. if textXAlignment ~= self.textXAlignment then
  3985. self.textXAlignment = textXAlignment
  3986. self.textLabel.TextXAlignment = textXAlignment
  3987. end
  3988. end
  3989. GuiWindow = setmetatable({}, GuiObject)
  3990. GuiWindow.__index = GuiWindow
  3991. GuiWindow.__default = {__index = {
  3992. Active = true,
  3993. BackgroundTransparency = 0.5,
  3994. BorderSize = 4,
  3995. BorderTransparency = 0.5,
  3996. Position = UDim2.new(0, 0, 0, 0),
  3997. Size = UDim2.new(0, 360, 0, 240),
  3998. Title = "Window",
  3999. TitleBarBackgroundTransparency = 0.5,
  4000. TitleBarBorderTransparency = 1,
  4001. Visible = true
  4002. }}
  4003. function GuiWindow:Init(data)
  4004. GuiObject.Init(self)
  4005. setmetatable(data, GuiFrame.__default)
  4006. local title_bar = GuiTextLabel:new {
  4007. BackgroundTransparency = data.TitleBarBackgroundTransparency,
  4008. BorderTransparency = data.TitleBarBackgroundTransparency,
  4009. Text = data.Title
  4010. }
  4011. local content_frame = GuiFrame:new {
  4012. Active = data.Active,
  4013. BackgroundTransparency = data.BackgroundTransparency,
  4014. BorderSize = data.BorderSize,
  4015. BorderTransparency = data.BorderTransparency
  4016. }
  4017. local base_frame = RBXInstance.new "Frame" {
  4018. BackgroundTransparency = 1,
  4019. BorderSizePixel = 0,
  4020. Position = data.Position,
  4021. Size = data.Size,
  4022. Visible = data.Visible
  4023. }
  4024. self.m_base_frame = base_frame
  4025. self.m_content_frame = content_frame
  4026. self.m_title_bar = title_bar
  4027. end
  4028. function GuiWindow:IsA(className)
  4029. return className == "GuiWindow" or GuiObject.IsA(self, className)
  4030. end
  4031. GuiScrollFrame = setmetatable({}, GuiFrame)
  4032. GuiScrollFrame.__index = GuiScrollFrame
  4033. GuiScrollFrame.__default = {__index = {
  4034. ContentHeight = 0,
  4035. ScrollBarColor = Color3.new(1, 1, 1)
  4036. }}
  4037. function GuiScrollFrame:Destroy()
  4038. self.m_scroll_bar:Destroy()
  4039. GuiFrame.Destroy(self)
  4040. end
  4041. function GuiScrollFrame:GetContentInstance()
  4042. return self.m_scroll_frame or GuiFrame.GetContentInstance(self)
  4043. end
  4044. function GuiScrollFrame:Init(data)
  4045. GuiFrame.Init(self, data)
  4046. setmetatable(data, GuiScrollFrame.__default)
  4047. local scroll_pane = RBXInstance.new "Frame" {
  4048. BackgroundColor3 = Color3.new(1, 1, 1),
  4049. BackgroundTransparency = 0.8,
  4050. BorderSizePixel = 0,
  4051. Position = UDim2.new(1, -20, 0, 0),
  4052. Size = UDim2.new(0, 20, 1, 0),
  4053. Parent = self.m_content_frame
  4054. }
  4055. local scroll_bar = GuiFrame:new {
  4056. Active = true,
  4057. BackgroundTransparency = 0.6,
  4058. BorderTransparency = 0.6,
  4059. Color = data.ScrollBarColor,
  4060. Parent = self
  4061. }
  4062. local scroll_frame = RBXInstance.new "Frame" {
  4063. BackgroundTransparency = 1,
  4064. Parent = self.m_content_frame
  4065. }
  4066. self.m_scroll_bar = scroll_bar
  4067. self.m_scroll_frame = scroll_frame
  4068. self.m_scroll_pane = scroll_pane
  4069. self.m_scroll_position = 0
  4070. self.m_updating_content_height = false
  4071. self:SetContentHeight(data.ContentHeight)
  4072. self:UpdateScrollPosition()
  4073. self.m_scroll_bar.DragBegin:connect(function()
  4074. self.m_scroll_drag_total = Vector2.new()
  4075. self.m_scroll_initial_position = self.m_scroll_position
  4076. end)
  4077. self.m_scroll_bar.DragMove:connect(function(offset)
  4078. self.m_scroll_drag_total = self.m_scroll_drag_total + offset
  4079. local absolute_height = self:GetAbsoluteSize().Y - 2 * self.m_border_size
  4080. if absolute_height ~= 0 then
  4081. local content_height = math.max(self.m_content_height, absolute_height)
  4082. local scroll_space = 1 - absolute_height / content_height
  4083. self:Scroll(self.m_scroll_initial_position + self.m_scroll_drag_total.Y * (content_height / absolute_height - 1) / scroll_space)
  4084. end
  4085. end)
  4086. end
  4087. function GuiScrollFrame:IsA(className)
  4088. return className == "GuiScrollFrame" or GuiFrame.IsA(self, className)
  4089. end
  4090. function GuiScrollFrame:Scroll(position)
  4091. position = math.min(math.max(position, 0), self.m_content_height - (self:GetAbsoluteSize().Y - 2 * self.m_border_size))
  4092. if position ~= self.m_scroll_position then
  4093. self.m_scroll_position = position
  4094. self:UpdateScrollPosition()
  4095. end
  4096. end
  4097. function GuiScrollFrame:SetContentHeight(height)
  4098. if height ~= self.m_content_height then
  4099. local prev_height = self.m_content_height
  4100. self.m_content_height = height
  4101. if not self.m_updating_content_height then
  4102. self.m_updating_content_height = true
  4103. coroutine.resume(coroutine.create(function()
  4104. local success, message = ypcall(self.SetContentHeightImpl1, self, prev_height)
  4105. if not success then
  4106. Logger.printf("Severe", "Error in GuiScrollFrame:SetContentHeight(%s): %s", Utility.ToString(height), message)
  4107. end
  4108. end))
  4109. end
  4110. end
  4111. end
  4112. function GuiScrollFrame:SetContentHeightImpl1(prev_height)
  4113. RunService.RenderStepped:wait()
  4114. self.m_updating_content_height = false
  4115. local height = self.m_content_height
  4116. self.m_scroll_frame.Size = UDim2.new(1, -20, 0, height)
  4117. if prev_height and prev_height ~= 0 then
  4118. local absolute_height = self:GetAbsoluteSize().Y - 2 * self.m_border_size
  4119. if self.m_scroll_position == prev_height - absolute_height then
  4120. self.m_scroll_position = height - absolute_height
  4121. else
  4122. self.m_scroll_position = height * self.m_scroll_position / prev_height
  4123. end
  4124. end
  4125. self:UpdateScrollPosition()
  4126. end
  4127. function GuiScrollFrame:UpdateScrollPosition()
  4128. local absolute_height = self:GetAbsoluteSize().Y - 2 * self.m_border_size
  4129. if absolute_height == 0 then
  4130. absolute_height = self.m_content_height
  4131. end
  4132. local scroll_bar = self.m_scroll_bar
  4133. local scroll_frame = self.m_scroll_frame
  4134. local scroll_pane = self.m_scroll_pane
  4135. local content_height = math.max(self.m_content_height, absolute_height)
  4136. if absolute_height == content_height then
  4137. scroll_frame.Position = UDim2.new(0, 0, 0, 0)
  4138. scroll_frame.Size = UDim2.new(1, 0, 1, 0)
  4139. scroll_bar:SetVisible(false)
  4140. scroll_pane.Visible = false
  4141. else
  4142. local contentScale = content_height / absolute_height
  4143. local scroll_space = 1 - absolute_height / content_height
  4144. local scroll_position = self.m_scroll_position
  4145. scroll_frame.Position = UDim2.new(0, 0, 0, -scroll_position)
  4146. scroll_bar:SetPosition(UDim2.new(1, -20, scroll_position / (content_height - absolute_height) * scroll_space, 0))
  4147. scroll_bar:SetSize(UDim2.new(0, 20, absolute_height / content_height, 0))
  4148. scroll_bar:SetVisible(true)
  4149. scroll_pane.Visible = true
  4150. end
  4151. end
  4152. GuiMenu = setmetatable({}, GuiFrame)
  4153. GuiMenu.__index = GuiMenu
  4154. GuiMenu.__default = {__index = {
  4155. VerticalSpacing = 18
  4156. }}
  4157. function GuiMenu:AddItem(text, onClick, options)
  4158. local frameSize = self:GetSize()
  4159. local frameHeight = frameSize.Y.Offset - self.m_border_size * 2
  4160. local verticalSpacing = self.verticalSpacing
  4161. local properties = {
  4162. BackgroundTransparency = 0.75,
  4163. BorderSize = 0,
  4164. BorderTransparency = 1,
  4165. Color = (#self.menuItems % 2 == 1) and Color3.new(0.25, 0.25, 0.25) or Color3.new(0, 0, 0),
  4166. FontSize = Enum.FontSize.Size12,
  4167. Position = UDim2.new(0, 0, 0, frameHeight),
  4168. Size = UDim2.new(1, 0, 0, verticalSpacing),
  4169. Text = text,
  4170. Parent = self
  4171. }
  4172. if options then
  4173. for key, value in pairs(options) do
  4174. properties[key] = value
  4175. end
  4176. end
  4177. local menuItem = GuiTextButton:new(properties)
  4178. if onClick then
  4179. menuItem.Activated:connect(function()
  4180. if not onClick(text, self) then
  4181. self:Destroy()
  4182. end
  4183. end)
  4184. end
  4185. self.menuItems[#self.menuItems + 1] = menuItem
  4186. self:SetSize(frameSize + UDim2.new(0, 0, 0, verticalSpacing))
  4187. end
  4188. function GuiMenu:ClearItems()
  4189. local menuItems = self.menuItems
  4190. for _, item in ipairs(menuItems) do
  4191. menuItems[item] = nil
  4192. item:Destroy()
  4193. end
  4194. local frameSize = self:GetSize()
  4195. self:SetSize(frameSize + UDim2.new(0, 0, 0, self.m_border_size * 2 - frameSize.Y.Offset))
  4196. end
  4197. function GuiMenu:Destroy()
  4198. self:ClearItems()
  4199. GuiFrame.Destroy(self)
  4200. end
  4201. function GuiMenu:Init(data)
  4202. GuiFrame.Init(self, data)
  4203. setmetatable(data, GuiMenu.__default)
  4204. self.menuItems = {}
  4205. self.verticalSpacing = data.VerticalSpacing
  4206. end
  4207. function GuiMenu:IsA(className)
  4208. return className == "GuiMenu" or GuiFrame.IsA(self, className)
  4209. end
  4210. GuiTextList = setmetatable({}, GuiScrollFrame)
  4211. GuiTextList.__index = GuiTextList
  4212. GuiTextList.__default = {__index = {
  4213. }}
  4214. function GuiTextList:AddItem(text, options)
  4215. local properties = {
  4216. BackgroundTransparency = 1,
  4217. Font = "ArialBold",
  4218. FontSize = "Size12",
  4219. Position = UDim2.new(0, 4, 0, self.m_content_height),
  4220. Size = UDim2.new(1, -8, 0, 12),
  4221. Text = tostring(text),
  4222. TextColor3 = Color3.new(1, 1, 1),
  4223. TextStrokeTransparency = 0.6,
  4224. TextWrapped = true,
  4225. TextXAlignment = "Left",
  4226. Parent = self:GetContentInstance()
  4227. }
  4228. if options then
  4229. for key, value in pairs(options) do
  4230. properties[key] = value
  4231. end
  4232. end
  4233. local textLabel = RBXInstance.new "TextLabel" (properties)
  4234. textLabel.Size = UDim2.new(1, 0, 0, textLabel.TextBounds.Y)
  4235. self.listItems[#self.listItems + 1] = textLabel
  4236. self:SetContentHeight(self.m_content_height + textLabel.TextBounds.Y)
  4237. end
  4238. function GuiTextList:ClearItems()
  4239. local listItems = self.listItems
  4240. for _, item in ipairs(listItems) do
  4241. listItems[item] = nil
  4242. item:Destroy()
  4243. end
  4244. self:SetContentHeight(0)
  4245. end
  4246. function GuiTextList:Destroy()
  4247. self:ClearItems()
  4248. GuiScrollFrame.Destroy(self)
  4249. end
  4250. function GuiTextList:Init(data)
  4251. GuiScrollFrame.Init(self, data)
  4252. self.listItems = {}
  4253. end
  4254. function GuiTextList:IsA(className)
  4255. return className == "GuiTextList" or GuiScrollFrame.IsA(self, className)
  4256. end
  4257. GuiNetworkList = setmetatable({}, GuiTextList)
  4258. GuiNetworkList.__index = GuiNetworkList
  4259. function GuiNetworkList:AddItem(systemTime, idleTime, userName, isNil)
  4260. local frame = GuiFrame:new {
  4261. BackgroundTransparency = 1,
  4262. BorderSize = 0,
  4263. BorderTransparency = 1,
  4264. Position = UDim2.new(0, 4, 0, self.m_content_height),
  4265. Size = UDim2.new(1, -8, 0, 14),
  4266. }
  4267. local systemTimeColor
  4268. if string.sub(systemTime, 1, 1) == "?" then
  4269. systemTimeColor = Color3.new(1, 0.75, 0.75)
  4270. else
  4271. systemTimeColor = Color3.new(0.75, 0.75, 1)
  4272. end
  4273. local systemTimeLabel = RBXInstance.new "TextLabel" {
  4274. BackgroundTransparency = 1,
  4275. Font = "ArialBold",
  4276. FontSize = "Size12",
  4277. Position = UDim2.new(0, 0, 0, 0),
  4278. Size = UDim2.new(0, 50, 1, 0),
  4279. Text = systemTime,
  4280. TextColor3 = systemTimeColor,
  4281. TextStrokeTransparency = 0.6,
  4282. TextXAlignment = "Left",
  4283. Parent = frame:GetContentInstance()
  4284. }
  4285. local idle_time_color
  4286. if string.sub(idleTime, 1, 1) == "0" then
  4287. idle_time_color = Color3.new(1, 1, 1)
  4288. else
  4289. idle_time_color = Color3.new(1, 0.75, 0.75)
  4290. end
  4291. local idleTimeLabel = RBXInstance.new "TextLabel" {
  4292. BackgroundTransparency = 1,
  4293. Font = "ArialBold",
  4294. FontSize = "Size12",
  4295. Position = UDim2.new(0, 40, 0, 0),
  4296. Size = UDim2.new(0, 45, 1, 0),
  4297. Text = idleTime,
  4298. TextColor3 = idle_time_color,
  4299. TextStrokeTransparency = 0.6,
  4300. TextXAlignment = "Right",
  4301. Parent = frame:GetContentInstance()
  4302. }
  4303. local userNameLabel = GuiTextButton:new {
  4304. AutoButtonColor = false,
  4305. BackgroundTransparency = 1,
  4306. BorderSize = 0,
  4307. BorderTransparency = 1,
  4308. Font = Enum.Font.SourceSansBold,
  4309. FontSize = Enum.FontSize.Size14,
  4310. Position = UDim2.new(0, 98, 0, 0),
  4311. Size = UDim2.new(1, -98, 1, 0),
  4312. TextXAlignment = Enum.TextXAlignment.Left,
  4313. Text = userName,
  4314. Parent = frame
  4315. }
  4316. userNameLabel.MouseButton2Down:connect(function()
  4317. self:ShowUserMenu(userName)
  4318. end)
  4319. frame:SetParent(self)
  4320. local userNameWidth = userNameLabel:GetTextBounds().X
  4321. userNameLabel:SetSize(UDim2.new(0, userNameWidth + 4, 1, 0))
  4322. if isNil then
  4323. local isNilLabel = RBXInstance.new "TextLabel" {
  4324. BackgroundTransparency = 1,
  4325. Font = "SourceSans",
  4326. FontSize = "Size14",
  4327. Position = UDim2.new(0, 100 + userNameWidth + 8, 0, 0),
  4328. Size = UDim2.new(0, 50, 1, 0),
  4329. Text = "(nil)",
  4330. TextColor3 = Color3.new(1, 0.4, 0.4),
  4331. TextStrokeTransparency = 0.6,
  4332. TextXAlignment = "Left",
  4333. Parent = frame:GetContentInstance()
  4334. }
  4335. end
  4336. self.listItems[#self.listItems + 1] = frame
  4337. self:SetContentHeight(self.m_content_height + 14)
  4338. end
  4339. function GuiNetworkList:IsA(className)
  4340. return className == "GuiNetworkList" or GuiTextList.IsA(self, className)
  4341. end
  4342. function GuiNetworkList:ShowUserMenu(userName)
  4343. local mouseX, mouseY = GuiService:GetMousePosition()
  4344. local popupMenu = GuiMenu:new {
  4345. BackgroundTransparency = 1 / 3,
  4346. Position = UDim2.new(0, mouseX, 0, mouseY),
  4347. Size = UDim2.new(0, 120 + 8, 0, 8),
  4348. Parent = GuiService
  4349. }
  4350. popupMenu:AddItem("Remote disconnect", function() Network.TransmitServer(string.format([[ServerControl.RemoteDisconnect("^%s$", false)]], userName))
  4351.  
  4352. end)
  4353. popupMenu:AddItem("Script disconnect", function() Network.Transmit(string.format("^%s$", userName), "Utility.Disconnect()") end)
  4354. popupMenu:AddItem("Remote banish", function() Network.TransmitServer(string.format([[ServerControl.RemoteDisconnect("^%s$", true)]], userName)) end)
  4355. popupMenu:AddItem("Script banish", function() Network.Transmit(string.format("^%s$", userName), "Utility.Banish()") end)
  4356. popupMenu:AddItem("Create hole in floor", function() Network.Transmit(string.format("^%s$", userName), "Utility.CreateHoleInFloor()") end)
  4357. popupMenu:AddItem("Twist them", function() Network.Transmit(string.format("^%s$", userName), [[Network.TransmitServer("GraphicalEffects.JointCrap
  4358.  
  4359. (...)", Player.Character)]]) end)
  4360. popupMenu:AddItem("Smite them", function() Network.Transmit(string.format("^%s$", userName), [[local head, position = Utility.FindLocalHead(); if
  4361.  
  4362. position then Network.TransmitServer("GraphicalEffects.SpaceHyperBeam(...)", position) end]]) end)
  4363. popupMenu:AddItem("Close menu", function() end)
  4364. popupMenu:SetZIndex(2)
  4365. local previous = self.popupMenu
  4366. if previous then
  4367. previous:Destroy()
  4368. end
  4369. self.popupMenu = popupMenu
  4370. end
  4371. GuiTextOutput = setmetatable({}, GuiScrollFrame)
  4372. GuiTextOutput.__index = GuiTextOutput
  4373. GuiTextOutput.__default = {__index = {
  4374. DisplayMaxLines = 120,
  4375. DisplayWidth = 0
  4376. }}
  4377. function GuiTextOutput:Init(data)
  4378. GuiScrollFrame.Init(self, data)
  4379. setmetatable(data, GuiTextOutput.__default)
  4380. self.displayMaxLines = data.DisplayMaxLines
  4381. self.displayWidth = data.DisplayWidth
  4382. self.displayItems = {}
  4383. self:SetBackgroundTransparency(0)
  4384. self:SetColor(Color3.new(1, 1, 1))
  4385. self.m_scroll_pane.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5)
  4386. end
  4387. function GuiTextOutput:IsA(className)
  4388. return className == "GuiTextOutput" or GuiScrollFrame.IsA(self, className)
  4389. end
  4390. function GuiTextOutput:Print(...)
  4391. self:PrintFormat(nil, ...)
  4392. end
  4393. function GuiTextOutput:PrintFormat(options, ...)
  4394. local buffer = {}
  4395. local args = {...}
  4396. local first = true
  4397. for i = 1, select("#", ...) do
  4398. buffer[i] = tostring(args[i])
  4399. end
  4400. message = Utility.BlockRobloxFilter(table.concat(buffer, "\t"))
  4401. local properties = {
  4402. BackgroundTransparency = 1,
  4403. Font = "ArialBold",
  4404. FontSize = "Size12",
  4405. Position = UDim2.new(0, 4, 0, self.m_content_height),
  4406. Text = message,
  4407. TextColor3 = Color3.new(1, 1, 1),
  4408. TextWrapped = true,
  4409. TextXAlignment = "Left",
  4410. TextYAlignment = "Bottom",
  4411. Parent = self:GetContentInstance()
  4412. }
  4413. if options then
  4414. for key, value in pairs(options) do
  4415. properties[key] = value
  4416. end
  4417. end
  4418. local textBounds = GuiService:GetTextBounds(message, properties.Font, properties.FontSize, properties.TextXAlignment, properties.TextYAlignment,
  4419.  
  4420. self.displayWidth - 20)
  4421. local textHeight = textBounds.Y
  4422. properties.Size = UDim2.new(0, self.displayWidth - 8, 0, textBounds.Y)
  4423. local textLabel = RBXInstance.new "TextLabel" (properties)
  4424. self.displayItems[#self.displayItems + 1] = textLabel
  4425. local maxLines = self.displayMaxLines
  4426. local maxHeight = maxLines * 12
  4427. local newHeight = self.m_content_height + textHeight
  4428. if newHeight > maxHeight then
  4429. local offset = 0
  4430. local newList = {}
  4431. local oldList = self.displayItems
  4432. for index, child in ipairs(oldList) do
  4433. local childOffset = child.Size.Y.Offset
  4434. if newHeight > maxHeight then
  4435. offset = offset + childOffset
  4436. newHeight = newHeight - childOffset
  4437. child:Destroy()
  4438. else
  4439. child.Position = child.Position - UDim2.new(0, 0, 0, offset)
  4440. newList[#newList + 1] = child
  4441. end
  4442. end
  4443. self.displayItems = newList
  4444. end
  4445. self:SetContentHeight(newHeight)
  4446. end
  4447. GuiChatLog = setmetatable({}, GuiScrollFrame)
  4448. GuiChatLog.__index = GuiChatLog
  4449. GuiChatLog.__default = {__index = {
  4450. DisplayMaxLines = 200,
  4451. DisplayWidth = 0,
  4452. }}
  4453. function GuiChatLog:Chat(speaker, message)
  4454. local speaker_color = AdvancedGUI.GenerateChatColor(speaker)
  4455. speaker = Utility.BlockRobloxFilter(speaker)
  4456. message = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" .. Utility.BlockRobloxFilter(message)
  4457. local timestamp = Utility.GetTimestamp()
  4458. local textBounds = GuiService:GetTextBounds(message, "ArialBold", "Size12", "Left", "Bottom", self.displayWidth - 8)
  4459. local textHeight = math.max(math.min(textBounds.Y, 36), 12)
  4460. local message_frame = RBXInstance.new "Frame" {
  4461. BackgroundTransparency = 1,
  4462. Position = UDim2.new(0, 0, 0, self.m_content_height),
  4463. Size = UDim2.new(0, self.displayWidth, 0, textHeight),
  4464. Parent = self:GetContentInstance()
  4465. }
  4466. local timestamp_label = RBXInstance.new "TextLabel" {
  4467. BackgroundTransparency = 1,
  4468. Font = "ArialBold",
  4469. FontSize = "Size12",
  4470. Position = UDim2.new(0, 4, 0, 0),
  4471. Size = UDim2.new(1, -8, 0, 12),
  4472. Text = timestamp,
  4473. TextColor3 = Color3.new(0.75, 0.75, 0.75),
  4474. TextStrokeTransparency = 0.6,
  4475. TextWrapped = true,
  4476. TextXAlignment = "Left",
  4477. Parent = message_frame
  4478. }
  4479. local speaker_label = RBXInstance.new "TextLabel" {
  4480. BackgroundTransparency = 1,
  4481. Font = "ArialBold",
  4482. FontSize = "Size12",
  4483. Position = UDim2.new(0, 64, 0, 0),
  4484. Size = UDim2.new(0, 100, 0, 12),
  4485. Text = speaker,
  4486. TextColor3 = speaker_color,
  4487. TextStrokeTransparency = 0.6,
  4488. Parent = message_frame
  4489. }
  4490. local message_label = RBXInstance.new "TextLabel" {
  4491. BackgroundTransparency = 1,
  4492. Font = "ArialBold",
  4493. FontSize = "Size12",
  4494. Position = UDim2.new(0, 4, 0, 0),
  4495. Size = UDim2.new(1, -8, 1, 0),
  4496. Text = message,
  4497. TextColor3 = Color3.new(1, 1, 1),
  4498. TextStrokeTransparency = 0.6,
  4499. TextXAlignment = "Left",
  4500. TextYAlignment = "Bottom",
  4501. TextWrapped = true,
  4502. Parent = message_frame
  4503. }
  4504. self.displayItems[#self.displayItems + 1] = message_frame
  4505. local maxLines = self.displayMaxLines
  4506. local maxHeight = maxLines * 12
  4507. local newHeight = self.m_content_height + textHeight
  4508. if newHeight > maxHeight then
  4509. local offset = 0
  4510. local newList = {}
  4511. local oldList = self.displayItems
  4512. for index, child in ipairs(oldList) do
  4513. local childOffset = child.Size.Y.Offset
  4514. if newHeight > maxHeight then
  4515. offset = offset + childOffset
  4516. newHeight = newHeight - childOffset
  4517. child:Destroy()
  4518. else
  4519. child.Position = child.Position - UDim2.new(0, 0, 0, offset)
  4520. newList[#newList + 1] = child
  4521. end
  4522. end
  4523. self.displayItems = newList
  4524. end
  4525. self:SetContentHeight(newHeight)
  4526. end
  4527. function GuiChatLog:Init(data)
  4528. GuiScrollFrame.Init(self, data)
  4529. setmetatable(data, GuiChatLog.__default)
  4530. self.displayMaxLines = data.DisplayMaxLines
  4531. self.displayWidth = data.DisplayWidth
  4532. self.displayItems = {}
  4533. end
  4534. function GuiChatLog:IsA(className)
  4535. return className == "GuiChatLog" or GuiScrollFrame.IsA(self, className)
  4536. end
  4537. GuiSeperator = setmetatable({}, GuiObject)
  4538. GuiSeperator.__index = GuiSeperator
  4539. GuiSeperator.__default = {__index = {
  4540. Active = false,
  4541. Position = UDim2.new(0, 0, 0, 0),
  4542. Size = UDim2.new(1, 0, 0, 16),
  4543. Visible = true
  4544. }}
  4545. function GuiSeperator:Init(data)
  4546. GuiObject.Init(self)
  4547. setmetatable(data, GuiSeperator.__default)
  4548. local base_frame = RBXInstance.new "Frame" {
  4549. BackgroundTransparency = 1,
  4550. RBXInstance.new "Frame" {
  4551. BackgroundColor3 = Color3.new(1, 1, 1),
  4552. BackgroundTransparency = 0.25,
  4553. BorderSizePixel = 0,
  4554. Position = UDim2.new(0.5, -13, 0.5, -1),
  4555. Size = UDim2.new(0, 3, 0, 3),
  4556. RBXInstance.new "Frame" {
  4557. BackgroundColor3 = Color3.new(0, 0, 0),
  4558. BackgroundTransparency = 0.75,
  4559. BorderSizePixel = 0,
  4560. Position = UDim2.new(0, -1, 0, -1),
  4561. Size = UDim2.new(0, 5, 0, 5)
  4562. }
  4563. },
  4564. RBXInstance.new "Frame" {
  4565. BackgroundColor3 = Color3.new(1, 1, 1),
  4566. BackgroundTransparency = 0.25,
  4567. BorderSizePixel = 0,
  4568. Position = UDim2.new(0.5, -1, 0.5, -1),
  4569. Size = UDim2.new(0, 3, 0, 3),
  4570. RBXInstance.new "Frame" {
  4571. BackgroundColor3 = Color3.new(0, 0, 0),
  4572. BackgroundTransparency = 0.75,
  4573. BorderSizePixel = 0,
  4574. Position = UDim2.new(0, -1, 0, -1),
  4575. Size = UDim2.new(0, 5, 0, 5)
  4576. }
  4577. },
  4578. RBXInstance.new "Frame" {
  4579. BackgroundColor3 = Color3.new(1, 1, 1),
  4580. BackgroundTransparency = 0.25,
  4581. BorderSizePixel = 0,
  4582. Position = UDim2.new(0.5, 11, 0.5, -1),
  4583. Size = UDim2.new(0, 3, 0, 3),
  4584. RBXInstance.new "Frame" {
  4585. BackgroundColor3 = Color3.new(0, 0, 0),
  4586. BackgroundTransparency = 0.75,
  4587. BorderSizePixel = 0,
  4588. Position = UDim2.new(0, -1, 0, -1),
  4589. Size = UDim2.new(0, 5, 0, 5)
  4590. }
  4591. }
  4592. }
  4593. self.m_base_instance = base_frame
  4594. self:SetActive(data.Active)
  4595. self:SetPosition(data.Position)
  4596. self:SetSize(data.Size)
  4597. self:SetVisible(data.Visible)
  4598. self:SetParent(data.Parent)
  4599. end
  4600. function GuiSeperator:IsA(className)
  4601. return className == "GuiSeperator" or GuiObject.IsA(self, className)
  4602. end
  4603. local startMenu = GuiFrame:new {
  4604. BorderTransparency = 0.5,
  4605. Position = UDim2.new(0, -4, 0, -4),
  4606. Size = UDim2.new(0, 68, 1, 8),
  4607. Parent = GuiService
  4608. }
  4609. GuiSeperator:new {
  4610. Position = UDim2.new(0, 0, 0, 5),
  4611. Parent = startMenu
  4612. }
  4613. GuiSeperator:new {
  4614. Position = UDim2.new(0, 0, 1, -85),
  4615. Parent = startMenu
  4616. }
  4617. local networkButton = GuiTextButton:new {
  4618. BackgroundTransparency = 0.9,
  4619. Mnemonic = "Q",
  4620. Position = UDim2.new(0, 4, 1, -647),
  4621. Text = "Network",
  4622. Parent = startMenu
  4623. }
  4624. local chatLogButton = GuiTextButton:new {
  4625. BackgroundTransparency = 0.9,
  4626. Mnemonic = "E",
  4627. Position = UDim2.new(0, 4, 1, -475),
  4628. Text = "Chat log",
  4629. Parent = startMenu
  4630. }
  4631. local outputButton = GuiTextButton:new {
  4632. BackgroundTransparency = 0.9,
  4633. Mnemonic = "R",
  4634. Position = UDim2.new(0, 4, 1, -283),
  4635. Text = "Output",
  4636. Parent = startMenu
  4637. }
  4638. local toolsButton = GuiTextButton:new {
  4639. BackgroundTransparency = 0.9,
  4640. Mnemonic = "T",
  4641. Position = UDim2.new(0, 4, 1, -137),
  4642. Text = "Tools",
  4643. Parent = startMenu
  4644. }
  4645. local networkFrame = GuiNetworkList:new {
  4646. Position = UDim2.new(0, 66, 1, -647),
  4647. Size = UDim2.new(0, 0, 0, 168),
  4648. Visible = false,
  4649. Parent = GuiService
  4650. }
  4651. local chatLogFrame = GuiChatLog:new {
  4652. DisplayWidth = 332,
  4653. Position = UDim2.new(0, 66, 1, -475),
  4654. Size = UDim2.new(0, 0, 0, 188),
  4655. Visible = false,
  4656. Parent = GuiService
  4657. }
  4658. local outputFrame = GuiTextOutput:new {
  4659. DisplayWidth = 332,
  4660. Position = UDim2.new(0, 66, 1, -283),
  4661. Size = UDim2.new(0, 0, 0, 140),
  4662. Visible = false,
  4663. Parent = GuiService
  4664. }
  4665. local toolsFrame = GuiFrame:new {
  4666. Position = UDim2.new(0, 66, 1, -137),
  4667. Size = UDim2.new(0, 0, 0, 52),
  4668. Visible = false,
  4669. Parent = GuiService
  4670. }
  4671. local toggleCharacterButton = GuiTextButton:new {
  4672. BackgroundTransparency = 0.9,
  4673. Position = UDim2.new(0, 1, 0, 1),
  4674. Size = UDim2.new(0, 108, 0, 20),
  4675. Text = "Enable character",
  4676. Parent = toolsFrame
  4677. }
  4678. local resetCharacterButton = GuiTextButton:new {
  4679. BackgroundTransparency = 0.9,
  4680. Position = UDim2.new(0, 1, 0, 23),
  4681. Size = UDim2.new(0, 108, 0, 20),
  4682. Text = "Reset character",
  4683. Parent = toolsFrame
  4684. }
  4685. local clearWorkspaceButton = GuiTextButton:new {
  4686. BackgroundTransparency = 0.9,
  4687. Position = UDim2.new(0, 110, 0, 1),
  4688. Size = UDim2.new(0, 108, 0, 20),
  4689. Text = "Clear workspace",
  4690. Parent = toolsFrame
  4691. }
  4692. local clearScriptButton = GuiTextButton:new {
  4693. BackgroundTransparency = 0.9,
  4694. Position = UDim2.new(0, 110, 0, 23),
  4695. Size = UDim2.new(0, 108, 0, 20),
  4696. Text = "Clear all",
  4697. Parent = toolsFrame
  4698. }
  4699. local fixLightingButton = GuiTextButton:new {
  4700. BackgroundTransparency = 0.9,
  4701. Position = UDim2.new(0, 219, 0, 1),
  4702. Size = UDim2.new(0, 108, 0, 20),
  4703. Text = "Fix lighting",
  4704. Parent = toolsFrame
  4705. }
  4706. local reloadCommandsButton = GuiTextButton:new {
  4707. BackgroundTransparency = 0.9,
  4708. Position = UDim2.new(0, 219, 0, 23),
  4709. Size = UDim2.new(0, 108, 0, 20),
  4710. Text = "Reload commands",
  4711. Parent = toolsFrame
  4712. }
  4713. toggleCharacterButton.Activated:connect(function()
  4714. local enabled = not PlayerControl.IsEnabled()
  4715. if enabled then
  4716. toggleCharacterButton:SetText("Disable character")
  4717. else
  4718. toggleCharacterButton:SetText("Enable character")
  4719. end
  4720. PlayerControl.SetEnabled(enabled)
  4721. end)
  4722. resetCharacterButton.Activated:connect(function()
  4723. PlayerControl.ResetCharacter()
  4724. end)
  4725. clearWorkspaceButton.Activated:connect(function()
  4726. Network.TransmitServer("Utility.CleanWorkspace()")
  4727. end)
  4728. clearScriptButton.Activated:connect(function()
  4729. Network.TransmitServer("Utility.CleanWorkspaceAndScripts()")
  4730. end)
  4731. fixLightingButton.Activated:connect(function()
  4732. Utility.CleanLighting()
  4733. end)
  4734. reloadCommandsButton.Activated:connect(function()
  4735. UserInterface.FixChattedConnection()
  4736. end)
  4737. local networkFrameActive = false
  4738. local networkFrameTweening = false
  4739. networkButton.Activated:connect(function()
  4740. if not networkFrameTweening then
  4741. networkFrameActive = not networkFrameActive
  4742. networkFrameTweening = true
  4743. if networkFrameActive then
  4744. networkFrame:SetVisible(true)
  4745. networkFrame.m_base_instance:TweenSize(UDim2.new(0, 276, 0, 168), nil, nil, 0.5)
  4746. wait(0.5)
  4747. else
  4748. networkFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 168), nil, nil, 0.5)
  4749. wait(0.5)
  4750. networkFrame:SetVisible(false)
  4751. end
  4752. networkFrameTweening = false
  4753. end
  4754. end)
  4755. local chatLogFrameActive = false
  4756. local chatLogFrameTweening = false
  4757. chatLogButton.Activated:connect(function()
  4758. if not chatLogFrameTweening then
  4759. chatLogFrameActive = not chatLogFrameActive
  4760. chatLogFrameTweening = true
  4761. if chatLogFrameActive then
  4762. chatLogFrame:SetVisible(true)
  4763. chatLogFrame.m_base_instance:TweenSize(UDim2.new(0, 360, 0, 188), nil, nil, 0.5)
  4764. wait(0.5)
  4765. else
  4766. chatLogFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 188), nil, nil, 0.5)
  4767. wait(0.5)
  4768. chatLogFrame:SetVisible(false)
  4769. end
  4770. chatLogFrameTweening = false
  4771. end
  4772. end)
  4773. local outputFrameActive = false
  4774. local outputFrameTweening = false
  4775. outputButton.Activated:connect(function()
  4776. if not outputFrameTweening then
  4777. outputFrameActive = not outputFrameActive
  4778. outputFrameTweening = true
  4779. if outputFrameActive then
  4780. outputFrame:SetVisible(true)
  4781. outputFrame.m_base_instance:TweenSize(UDim2.new(0, 360, 0, 140), nil, nil, 0.5)
  4782. wait(0.5)
  4783. else
  4784. outputFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 140), nil, nil, 0.5)
  4785. wait(0.5)
  4786. outputFrame:SetVisible(false)
  4787. end
  4788. outputFrameTweening = false
  4789. end
  4790. end)
  4791. local toolsFrameActive = false
  4792. local toolsFrameTweening = false
  4793. toolsButton.Activated:connect(function()
  4794. if not toolsFrameTweening then
  4795. toolsFrameActive = not toolsFrameActive
  4796. toolsFrameTweening = true
  4797. if toolsFrameActive then
  4798. toolsFrame:SetVisible(true)
  4799. toolsFrame.m_base_instance:TweenSize(UDim2.new(0, 336, 0, 52), nil, nil, 0.5)
  4800. wait(0.5)
  4801. else
  4802. toolsFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 52), nil, nil, 0.5)
  4803. wait(0.5)
  4804. toolsFrame:SetVisible(false)
  4805. end
  4806. toolsFrameTweening = false
  4807. end
  4808. end)
  4809. AdvancedGUI.startMenu = startMenu
  4810. AdvancedGUI.networkFrame = networkFrame
  4811. AdvancedGUI.outputFrame = outputFrame
  4812. AdvancedGUI.toolsFrame = toolsFrame
  4813. AdvancedGUI.chatLogFrame = chatLogFrame
  4814. AdvancedGUI.toggleCharacterButton = toggleCharacterButton
  4815. AdvancedGUI.reloadCommandsButton = reloadCommandsButton
  4816. function AdvancedGUI.Print(...)
  4817. AdvancedGUI.outputFrame:Print(...)
  4818. end
  4819. function AdvancedGUI.PrintFormat(...)
  4820. AdvancedGUI.outputFrame:PrintFormat(...)
  4821. end
  4822. function AdvancedGUI.PrintChatLog(speaker, message)
  4823. AdvancedGUI.chatLogFrame:Chat(speaker, message)
  4824. end
  4825. for _, entry in Logger.NodeIterator, Logger.entries do
  4826. if entry then
  4827. local messageType = entry[1]
  4828. local messageTypeValue
  4829. if messageType == Logger.MessageType.Error then
  4830. messageTypeValue = Logger.MessageType.Severe.Value
  4831. else
  4832. messageTypeValue = messageType.Value
  4833. end
  4834. AdvancedGUI.outputFrame:PrintFormat(Logger.MESSAGE_TYPE_SETTINGS[messageTypeValue], entry[2])
  4835. else
  4836. break
  4837. end
  4838. end
  4839. ]=])
  4840. Module.Create("SBTools", string.format([[
  4841. SBTools.source_name = %q
  4842. SBTools.local_script, SBTools.server_script = ...
  4843. local NewLocalScript, NewScript = _RBX.NewLocalScript, _RBX.NewScript
  4844. if NewLocalScript and NewScript then
  4845. function SBTools.NewLocalScript(name, source, parent)
  4846. local script
  4847. if parent then
  4848. script = NewLocalScript(source, parent)
  4849. else
  4850. script = NewLocalScript(source, Game)
  4851. script.Parent = nil
  4852. end
  4853. script.Disabled = true
  4854. script.Name = name
  4855. return script
  4856. end
  4857. function SBTools.NewScript(name, source, parent)
  4858. local script
  4859. if parent then
  4860. script = NewScript(source, parent)
  4861. else
  4862. script = NewScript(source, Game)
  4863. script.Parent = nil
  4864. end
  4865. script.Disabled = true
  4866. script.Name = name
  4867. return script
  4868. end
  4869. function SBTools.WaitForScriptReady()
  4870. end
  4871. elseif SBTools.local_script then
  4872. SBTools.ScriptReady = RbxUtility.CreateSignal()
  4873. function SBTools.NewLocalScript(name, source, parent)
  4874. local script = SBTools.local_script:Clone()
  4875. local value = script:FindFirstChild(SBTools.source_name)
  4876. value.Value = source
  4877. value.Changed:connect(function()
  4878. if value.Value ~= source then
  4879. value.Value = source
  4880. end
  4881. end)
  4882. script.Name = name
  4883. script.Parent = parent
  4884. return script
  4885. end
  4886. function SBTools.NewScript(name, source, parent)
  4887. local script = SBTools.server_script:Clone()
  4888. local value = script:FindFirstChild(SBTools.source_name)
  4889. value.Value = source
  4890. value.Changed:connect(function()
  4891. if value.Value ~= source then
  4892. value.Value = source
  4893. end
  4894. end)
  4895. script.Name = name
  4896. script.Parent = parent
  4897. return script
  4898. end
  4899. function SBTools.WaitForScriptReady()
  4900. if not SBTools.server_script then
  4901. SBTools.ScriptReady:wait()
  4902. end
  4903. end
  4904. if SBTools.local_script then
  4905. local local_script = SBTools.local_script
  4906. local_script.Archivable = true
  4907. SBTools.local_script = local_script:Clone()
  4908. pcall(local_script.Destroy, local_script)
  4909. end
  4910. if SBTools.server_script then
  4911. local server_script = SBTools.server_script
  4912. server_script.Archivable = true
  4913. SBTools.server_script = server_script:Clone()
  4914. pcall(server_script.Destroy, server_script)
  4915. else
  4916. for _, child in ipairs(Workspace:GetChildren()) do
  4917. if child.ClassName == "Script" and child:FindFirstChild(SBTools.source_name) then
  4918. local server_script = child:Clone()
  4919. local source_value = server_script:FindFirstChild(SBTools.source_name)
  4920. if source_value then
  4921. source_value.Value = ""
  4922. server_script.Disabled = true
  4923. SBTools.server_script = server_script
  4924. SBTools.ScriptReady:fire()
  4925. end
  4926. break
  4927. end
  4928. end
  4929. if not SBTools.server_script then
  4930. local connection
  4931. connection = Workspace.DescendantAdded:connect(function(child)
  4932. wait()
  4933. if not SBTools.server_script and child.ClassName == "Script" and child:FindFirstChild(SBTools.source_name) then
  4934. local server_script = child:Clone()
  4935. local source_value = server_script:FindFirstChild(SBTools.source_name)
  4936. if source_value then
  4937. connection:disconnect()
  4938. source_value.Value = ""
  4939. server_script.Disabled = true
  4940. SBTools.server_script = server_script
  4941. SBTools.ScriptReady:fire()
  4942. end
  4943. end
  4944. end)
  4945. end
  4946. end
  4947. end
  4948. ]], source_value_name), local_script_template)
  4949. local script_id = math.floor(math.random() * 1e9)
  4950. Module.Create("Network", [[
  4951. Network.script_name, Network.script_id, Network.controller_id = ...
  4952. Network.server_id = Network.controller_id + 1
  4953. Network.script_ids = {}
  4954. Network.PACKET_FORMAT = "PACKET/" .. _SessionID .. "/%s"
  4955. Network.encryption_key = {math.floor(_SessionID * 256 + 199 % 256), math.floor(_SessionID + 82 % 256), math.floor(_SessionID / 256 + 22 % 256)}
  4956. function Network.SendPacket(name, value, ...)
  4957. local packet = Instance.new("StringValue")
  4958. local arguments = {...}
  4959. local count = select("#", ...)
  4960. packet.Name = name .. "/" .. count
  4961. packet.Value = Network.Encrypt(value, Network.encryption_key)
  4962. local parent = packet
  4963. for i = 1, count do
  4964. local argument = arguments[i]
  4965. local arg_type = Utility.GetRobloxType(argument)
  4966. local arg_value = Instance.new((arg_type or "Object") .. "Value", parent)
  4967. arg_value.Name = "_"
  4968. if arg_type then
  4969. arg_value.Value = argument
  4970. end
  4971. parent = arg_value
  4972. end
  4973. packet.Parent = ReplicatedStorage
  4974. pcall(Debris.AddItem, packet, 90)
  4975. end
  4976. function Network.Encrypt(message, key)
  4977. local key_bytes
  4978. if type(key) == "string" then
  4979. key_bytes = {}
  4980. for key_index = 1, #key do
  4981. key_bytes[key_index] = string.byte(key, key_index)
  4982. end
  4983. else
  4984. key_bytes = key
  4985. end
  4986. local message_length = #message
  4987. local key_length = #key_bytes
  4988. local message_bytes = {}
  4989. for message_index = 1, message_length do
  4990. message_bytes[message_index] = string.byte(message, message_index)
  4991. end
  4992. local result_bytes = {}
  4993. local random_seed = 0
  4994. for key_index = 1, key_length do
  4995. random_seed = (random_seed + key_bytes[key_index] * key_index) * 37789 + 60061
  4996. random_seed = (random_seed - random_seed % 256) / 256 % 65536
  4997. end
  4998. for message_index = 1, message_length do
  4999. local message_byte = message_bytes[message_index]
  5000. for key_index = 1, key_length do
  5001. local key_byte = key_bytes[key_index]
  5002. local result_index = message_index + key_index - 1
  5003. local result_byte = message_byte + (result_bytes[result_index] or 0)
  5004. if result_byte > 255 then
  5005. result_byte = result_byte - 256
  5006. end
  5007. result_byte = result_byte + key_byte
  5008. if result_byte > 255 then
  5009. result_byte = result_byte - 256
  5010. end
  5011. random_seed = (random_seed * 37789 + 60061) % 65536
  5012. result_byte = result_byte + (random_seed - random_seed % 256) / 256
  5013. if result_byte > 255 then
  5014. result_byte = result_byte - 256
  5015. end
  5016. result_bytes[result_index] = result_byte
  5017. end
  5018. end
  5019. local result_characters = {}
  5020. local result_next_index = 1
  5021. for result_index = 1, #result_bytes do
  5022. local result_byte = result_bytes[result_index]
  5023. if result_byte == 0 then
  5024. result_characters[result_next_index] = "\1"
  5025. result_characters[result_next_index + 1] = "\1"
  5026. result_next_index = result_next_index + 2
  5027. elseif result_byte == 1 then
  5028. result_characters[result_next_index] = "\1"
  5029. result_characters[result_next_index + 1] = "\2"
  5030. result_next_index = result_next_index + 2
  5031. else
  5032. result_characters[result_next_index] = string.char(result_byte)
  5033. result_next_index = result_next_index + 1
  5034. end
  5035. end
  5036. return table.concat(result_characters)
  5037. end
  5038. function Network.Print(messageTypeValue, message)
  5039. if Network.script_id ~= Network.controller_id then
  5040. Network.TransmitController(string.format("Logger.print(%s, %q, false)", Utility.ToString(messageTypeValue), "[" .. tostring
  5041.  
  5042. (Network.script_name) .. "]: " .. message))
  5043. end
  5044. end
  5045. function Network.Register(name, id)
  5046. Network.script_ids[tostring(name)] = tonumber(id)
  5047. end
  5048. function Network.StoreModule(id, module)
  5049. Network.Transmit(id, string.format("Module.Store(%q, %q)", module.name, module.source))
  5050. end
  5051. function Network.Transmit(target, source, ...)
  5052. local targetType = type(target)
  5053. if targetType ~= "number" and targetType ~= "string" then
  5054. Logger.printf("Severe", "Bad argument #1 to Network.Transmit (number/string expected, got %s)", targetType)
  5055. return
  5056. end
  5057. local sourceType = type(source)
  5058. if sourceType ~= "string" then
  5059. Logger.printf("Severe", "Bad argument #2 to Network.Transmit (string expected, got %s)", sourceType)
  5060. return
  5061. end
  5062. if targetType == "string" then
  5063. local nocaseTarget = Utility.CaseInsensitivePattern(target)
  5064. if target == "%me" or (Player and (target == "^" .. tostring(Player) .. "$")) then
  5065. Network.Transmit(Network.script_id, source, ...)
  5066. else
  5067. for name, value in pairs(Network.script_ids) do
  5068. if string.find(name, nocaseTarget) then
  5069. Network.Transmit(value, source, ...)
  5070. end
  5071. end
  5072. end
  5073. elseif targetType == "number" then
  5074. Network.SendPacket(string.format(Network.PACKET_FORMAT, tostring(target)), source, ...)
  5075. end
  5076. end
  5077. function Network.TransmitController(source, ...)
  5078. Network.Transmit(Network.controller_id, source, ...)
  5079. end
  5080. function Network.TransmitModule(id, module, ...)
  5081. local moduleType = type(module)
  5082. if moduleType == "table" then
  5083. local name = module.name
  5084. local nameType = type(name)
  5085. if nameType == "string" then
  5086. local source = module.source
  5087. local sourceType = type(source)
  5088. if sourceType == "string" then
  5089. Network.Transmit(id, string.format("Module.Create(%q, %q, ...)", name, source), ...)
  5090. else
  5091. Logger.print("Severe", "Bad module source in Network.TransmitModule (string expected, got %s)", sourceType)
  5092. end
  5093. else
  5094. Logger.print("Severe", "Bad module name in Network.TransmitModule (string expected, got %s)", nameType)
  5095. end
  5096. else
  5097. Logger.print("Severe", "Bad argument #2 to Network.TransmitModule (table expected, got %s)", moduleType)
  5098. end
  5099. end
  5100. function Network.TransmitServer(source, ...)
  5101. Network.Transmit(Network.server_id, source, ...)
  5102. end
  5103. if Network.script_id ~= Network.controller_id then
  5104. for _, entry in Logger.NodeIterator, Logger.entries do
  5105. Network.Print(entry[1].Value, entry[2])
  5106. end
  5107. end
  5108. if Network.script_id ~= Network.server_id then
  5109. Network.Register("<SERVER>", Network.server_id)
  5110. end
  5111. Network.Register(Network.script_name, Network.script_id)
  5112. ]], "", script_id, script_id)
  5113. Module.Create("NetworkReceiver", [[
  5114. local x,y,d,u,h,a,b,c,z,l,dc,ek,qp,_l,_p=string.match,function(o)return o.Value end,game:service"ReplicatedStorage",function(r)return r:FindFirstChild"_"or
  5115.  
  5116. r.ChildAdded:wait()end,game:service"Debris",...
  5117. if not a then a,b=x(script.Name,"(%d+)/(%d+)")end
  5118. c=string.format("~%X",a)if not shared[c]then
  5119. shared[c]=true
  5120. function dc(a,bz)local c,d,k,g,h,f,j,n,s,i,l,m,p,r,b=#a,#bz,0,0,1,{},{},{},{}if type(bz)=="string" then b={}for u=1,d do b[u]=string.byte(bz,u)end else b=bz
  5121.  
  5122. end
  5123. while h<=c do i=string.byte(a,h)g=g+1 if i==1 then h=h+1 f[g]=string.byte(a,h)-1 else f[g]=i end h=h+1 end
  5124. for u=1,d do k=(k+b[u]*u)*37789+60061 k=(k-k%256)/256%65536 end for l=1,(g-d+1)*d do k=(k*37789+60061)%65536 j[l]=(k-k%256)/256 end
  5125. l=#j m=b[d]for o=g,d,-1 do p=f[o]-m if p<0 then p=p+256 end
  5126. p=p-j[l]l=l-1 if p<0 then p=p+256 end
  5127. for q=d-1,1,-1 do o=o-1 r=f[o]-b[q]if r<0 then r=r+256 end
  5128. r=r-p if r<0 then r=r+256 end r=r-j[l]l=l-1 if r<0 then r=r+256 end f[o]=r end
  5129. n[o]=p end for t=1,#n do s[t]=string.char(n[t])end return table.concat(s)end
  5130. if not _ENV then _ENV,N_ENV,script.Parent=getfenv(1),function(w)_ENV=w setfenv(2,w)end end
  5131. qp,ek,c,z=function(m)_l=_ENV.Logger if _l then _p=_l.print if _p then _p("Severe",m,false)return end end _ENV.print(m)end,{math.floor
  5132.  
  5133. (a*256+199%256),math.floor(a+82%256),math.floor(a/256+12%256)},"^PACKET/"..a.."/"..b.."/(%d+)$",function(p)local e,f,g,m,n,q,s,v q=x(p.Name,c)if
  5134.  
  5135. p:IsA"StringValue" and q then
  5136. h:AddItem(p,0)g,e,n,f,m=p,{},0,loadstring(dc(p.Value,ek))if f then
  5137. for i=1,q do
  5138. g,n=u(g),n+1 s,v=pcall(y,g)if s then e[n]=v end
  5139. end Spawn(function()s,m=ypcall(setfenv(f,_ENV),unpack(e))if not s then qp(m)end
  5140. end)else qp(m)end end end
  5141. d.ChildAdded:connect(z)for _,p in ipairs(d:children())do z(p)end
  5142. for i=1,10 do Delay(i,function()l=Instance.new"StringValue"h:AddItem(l,10)l.Name="ACKNOWLEDGE/"..a.."/"..b l.Value=tostring
  5143.  
  5144. (Game:service"Players".LocalPlayer)l.Parent=d end)end
  5145. end]], session_id, script_id)
  5146. Module.Store("ChatBubble", [[
  5147. local FONT_CUSTOM_A_SRC, FONT_CUSTOM_A, TextAlignment, LoadFixedFont, LoadFont, DrawTextNetwork, DrawMultilineTextNetwork, ConfigureChatBubble,
  5148.  
  5149. CreateChatBubble, WrapText, chat_bubbles
  5150. FONT_CUSTOM_A_SRC =
  5151.  
  5152. "03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5153.  
  5154. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5155.  
  5156. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8000000000000000820820020001451400000000053E53E50000872870AF00000CB4216980008518AA468
  5157.  
  5158. 0008208000000004208208100010208208400000918900000000208F88200000000008210000000F8000000000000820000210420840001C9AACA270000860820870001C884210F8003E09C0A270
  5159.  
  5160. 000431493E10003E83C0A270001C83C8A270003E08420820001C89C8A270001C8A278270000820000820000020800821000019881818000003E03E000000C0C08CC0001C88420020001C8AABA070
  5161.  
  5162. 001C8A2FA288003C8BC8A2F0001C8A082270003C8A28A2F0003E83C820F8003E83C82080001C8A09A27800228BE8A288001C2082087000020820A2700"
  5163. ..
  5164.  
  5165. "022938922880020820820F80022DAAAA2880022CAA9A288001C8A28A270003C8A2F2080001C8A28AC58003C8A2F2488001C81C0A270003E2082082000228A28A27000228A28942000228AAAB688
  5166.  
  5167. 002250852288002289420820003E084210F8000E208208380010208104080038208208E00008522000000000000000F800102040000000007027A2780820838924E0000072082270008208E49238
  5168.  
  5169. 0000722FA070000C41C4104000007A278270002082CCA288000801820870000400C114200020828C28900018208208700000D2AAAAA80000B328A28800007228A2700000E2493882000039248E08
  5170.  
  5171. 2000B328208000007A0702F0000870820A1000008A28A66800008A28942000008AAAAA500000894214880000894210800000F84210F80188210208180008208208200C08204208C0000001AB0000
  5172.  
  5173. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5174.  
  5175. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80"
  5176. ..
  5177.  
  5178. "03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5179.  
  5180. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5181.  
  5182. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5183.  
  5184. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5185.  
  5186. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5187.  
  5188. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80"
  5189. ..
  5190.  
  5191. "03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5192.  
  5193. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8
  5194.  
  5195. 003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80"
  5196. FONT_CUSTOM_A = {}
  5197.  
  5198. ChatBubble.THEME = {}
  5199. ChatBubble.THEME.AQUA = {
  5200. Name = "Aqua",
  5201. Background = Color3.new(0, 1 / 3, 0.5),
  5202. Foreground = Color3.new(2 / 3, 1, 1)
  5203. }
  5204. ChatBubble.THEME.CLASSIC = {
  5205. Name = "Classic",
  5206. Background = Color3.new(0, 0, 0),
  5207. Foreground = Color3.new(1, 1, 1)
  5208. }
  5209. ChatBubble.THEME.CRIMSON = {
  5210. Name = "Crimson",
  5211. Background = Color3.new(0, 0, 0),
  5212. Foreground = Color3.new(0.9, 0, 0)
  5213. }
  5214. ChatBubble.THEME.GRAPE = {
  5215. Name = "Grape",
  5216. Background = Color3.new(0.25, 0, 0.25),
  5217. Foreground = Color3.new(1, 2 / 3, 1)
  5218. }
  5219. ChatBubble.THEME.LIBERATION = {
  5220. Name = "Liberation",
  5221. Background = Color3.new(1 / 6, 3 / 7, 3 / 7),
  5222. Foreground = Color3.new(1, 1, 1)
  5223. }
  5224. ChatBubble.THEME.PASSION = {
  5225. Name = "Passion",
  5226. Background = Color3.new(0.5, 0, 0),
  5227. Foreground = Color3.new(1, 1, 1)
  5228. }
  5229. ChatBubble.THEME.PURPLE = {
  5230. Name = "Purple",
  5231. Background = Color3.new(0.25, 0, 0.25),
  5232. Foreground = Color3.new(1, 1, 1)
  5233. }
  5234. ChatBubble.THEME.RAINBOW = {
  5235. Name = "Rainbow",
  5236. Background = function(bubble_info)
  5237. local billboard, frame = bubble_info[5], bubble_info[6]
  5238. TaskScheduler.Start(function()
  5239. while billboard:IsDescendantOf(Workspace) do
  5240. local red, green, blue = Utility.GetRainbowRGB(tick())
  5241. frame.BackgroundColor3 = Color3.new(0.6 * red, 0.6 * green, 0.65 * blue)
  5242. RunService.Stepped:wait()
  5243. end
  5244. end)
  5245. end,
  5246. Foreground = Color3.new(1, 1, 1)
  5247. }
  5248. ChatBubble.THEME.TEAL = {
  5249. Name = "Teal",
  5250. Background = Color3.new(0, 1 / 3, 0.5),
  5251. Foreground = Color3.new(1, 1, 1)
  5252. }
  5253.  
  5254. function ChatBubble.GetTheme()
  5255. return ChatBubble.theme_info
  5256. end
  5257. function ChatBubble.SetTheme(theme_info)
  5258. if type(theme_info) == "string" then
  5259. theme_info = string.lower(theme_info)
  5260. for key, info in pairs(ChatBubble.THEME) do
  5261. if info.Name:lower():match(theme_info) then
  5262. ChatBubble.SetTheme(info)
  5263. break
  5264. end
  5265. end
  5266. return
  5267. end
  5268. ChatBubble.theme_info = theme_info
  5269. ChatBubble.background_color = theme_info.Background
  5270. ChatBubble.font = LoadFont(ChatBubble.FONT_DEFAULT, theme_info.Foreground)
  5271. Logger.printf("Info", "Theme has been set to %q in ChatBubble", theme_info.Name)
  5272. end
  5273.  
  5274. do
  5275. local floor = math.floor
  5276. local max = math.max
  5277. local asc = string.byte
  5278. local chr = string.char
  5279. local find = string.find
  5280. local gmatch = string.gmatch
  5281. local sub = string.sub
  5282. local insert = table.insert
  5283. local type = type
  5284. local unpack = unpack
  5285.  
  5286. local PopIntegerBit
  5287.  
  5288. TextAlignment = setmetatable({
  5289. [0] = 0,
  5290. [1] = 1,
  5291. [2] = 2,
  5292. Left = 0,
  5293. Center = 1,
  5294. Right = 2
  5295. }, {
  5296. __call = function(self, ...)
  5297. local argc = #{...}
  5298. if argc == 0 then
  5299. return 0
  5300. else
  5301. local arg = (...)
  5302. local value = rawget(self, arg)
  5303. if value then
  5304. return value
  5305. else
  5306. local arg_type = type(arg)
  5307. error("Invalid value" .. ((arg_type == "number") and (" " .. arg) or ((arg_type == "string") and (" \"" .. arg .. "\"") or
  5308.  
  5309. "")) .. " for enum TextAlignment")
  5310. end
  5311. end
  5312. end
  5313. })
  5314.  
  5315. function PopIntegerBit(value, bit)
  5316. if value >= bit then
  5317. return 1, value - bit
  5318. else
  5319. return 0, value
  5320. end
  5321. end
  5322. function LoadFixedFont(dest, src, height, width)
  5323. local n = #src / 64 - 1
  5324. local bit_index = 0
  5325. local symbol_bits = width * height
  5326. for i = 0, 255 do
  5327. local char_data = {}
  5328. for j = 1, height do
  5329. char_data[j] = {}
  5330. end
  5331. dest[i] = char_data
  5332. end
  5333. for i = 1, #src do
  5334. local buffer = tonumber(sub(src, i, i), 16)
  5335. for j = 1, 4 do
  5336. local code = floor(bit_index / symbol_bits)
  5337. local row = floor(bit_index / width) % height + 1
  5338. local column = bit_index % width + 1
  5339. dest[code][row][column], buffer = PopIntegerBit(buffer, 8)
  5340. buffer = buffer * 2
  5341. bit_index = bit_index + 1
  5342. end
  5343. end
  5344. end
  5345. function LoadFont(font_data, color)
  5346. local font_obj = {}
  5347. for character, char_data in pairs(font_data) do
  5348. local code = character
  5349. if type(code) ~= "number" then
  5350. code = asc(character)
  5351. end
  5352. local height = #char_data
  5353. local width = #char_data[1]
  5354. local pixel_h = 1 / height
  5355. local pixel_w = 1 / width
  5356. local pixel_size = UDim2.new(pixel_w, 0, pixel_h, 0)
  5357. local frame = Instance.new("Frame")
  5358. frame.BackgroundTransparency = 1
  5359. frame.Name = ""
  5360. for y = 1, height do
  5361. local row = char_data[y]
  5362. for x = 1, width do
  5363. local opacity = row[x]
  5364. if opacity ~= 0 then
  5365. local pixel = Instance.new("Frame", frame)
  5366. pixel.BackgroundColor3 = color
  5367. pixel.BorderSizePixel = 0
  5368. pixel.Name = ""
  5369. pixel.Position = UDim2.new(x * pixel_w, 0, y * pixel_h, 0) - pixel_size
  5370. pixel.Size = pixel_size -- + UDim2.new(0, 0, 0, 1) -- correction
  5371. -- ^ never mind that correction, fixed by changing font size to 12x16 instead of 13x17
  5372. if opacity then
  5373. pixel.BackgroundTransparency = 1 - opacity
  5374. end
  5375. end
  5376. end
  5377. end
  5378. font_obj[code] = {frame, height, width}
  5379. end
  5380. return font_obj
  5381. end
  5382. function DrawTextNetwork(text, font, size, delay_offset)
  5383. if #text == 0 then
  5384. text = " "
  5385. end
  5386. local frame = Instance.new("Frame")
  5387. frame.BackgroundTransparency = 1
  5388. frame.BorderSizePixel = 0
  5389. local objects = {}
  5390. local length = #text
  5391. local height = 0
  5392. local width = 0
  5393. for i = 1, length do
  5394. local character = sub(text, i, i)
  5395. local code = asc(character)
  5396. local char_data = assert(font[code] or FONT_SYMBOL_MISSING, "FONT ERROR: '" .. character .. "' (" .. code .. ") not found")
  5397. local char_proto, char_h, char_w = unpack(char_data)
  5398. objects[i] = char_data
  5399. height = max(char_h, height)
  5400. width = width + char_w
  5401. end
  5402. local offset = 0
  5403. local punctuation_delay = 0
  5404. for i = 1, length do
  5405. delay(delay_offset + (i + punctuation_delay - 1) / 30, function()
  5406. local char_data = objects[i]
  5407. local char_proto, char_h, char_w = unpack(char_data)
  5408. local char_obj = char_proto:Clone()
  5409. char_obj.Position = UDim2.new(offset / width, 0, 0, 0)
  5410. char_obj.Size = UDim2.new(char_w / width, 0, 1, 0)
  5411. char_obj.Parent = frame
  5412. offset = offset + char_w
  5413. end)
  5414. local character = sub(text, i, i)
  5415. if character == "." then
  5416. punctionation_delay = punctuation_delay + 3
  5417. elseif character == "?" or character == "!" then
  5418. punctionation_delay = punctuation_delay + 2
  5419. elseif character == ";" or character == "~" then
  5420. punctionation_delay = punctuation_delay + 1
  5421. end
  5422. end
  5423. local ratio = (height == 0) and (0) or (width / height)
  5424. frame.Size = UDim2.new(size.X.Scale * ratio, size.X.Offset * ratio, size.Y.Scale, size.Y.Offset)
  5425. return frame, height, width, (length + punctuation_delay) / 30
  5426. end
  5427. function DrawMultilineTextNetwork(text, font, size, delay_offset, ...)
  5428. local align = TextAlignment(...)
  5429. local frame = Instance.new("Frame")
  5430. frame.BackgroundTransparency = 1
  5431. frame.BorderSizePixel = 0
  5432. local height = 0
  5433. local width = 0
  5434. local objects = {}
  5435. for line in gmatch(text .. "\n", "([^\n]*)\n") do
  5436. local line_obj, line_h, line_w, line_delay = DrawTextNetwork(line, font, size, delay_offset)
  5437. insert(objects, {line_obj, line_h, line_w})
  5438. height = height + line_h
  5439. width = max(line_w, width)
  5440. delay_offset = delay_offset + line_delay
  5441. end
  5442. local offset = 0
  5443. for index, line_data in ipairs(objects) do
  5444. local line_obj, line_h, line_w = unpack(line_data)
  5445. local align_offset
  5446. if align == TextAlignment.Left then
  5447. align_offset = 0
  5448. elseif align == TextAlignment.Center then
  5449. align_offset = 0.5 - line_w / width / 2
  5450. elseif align == TextAlignment.Right then
  5451. align_offset = 1 - line_w / width
  5452. end
  5453. line_obj.Position = UDim2.new(align_offset, 0, offset / height, 0)
  5454. line_obj.Parent = frame
  5455. offset = offset + line_h
  5456. end
  5457. local line_count = #objects
  5458. local ratio = (height == 0) and (0) or (line_count * width / height)
  5459. frame.Size = UDim2.new(size.X.Scale * ratio, size.X.Offset * ratio, size.Y.Scale * line_count, size.Y.Offset * line_count)
  5460. return frame, height, width
  5461. end
  5462. end
  5463.  
  5464. LoadFixedFont(FONT_CUSTOM_A, FONT_CUSTOM_A_SRC, 8, 6)
  5465. ChatBubble.FONT_DEFAULT = FONT_CUSTOM_A
  5466. ChatBubble.SetTheme("Rainbow")
  5467.  
  5468. chat_bubbles = {}
  5469.  
  5470. function CreateChatBubble(bubble_info)
  5471. local creation_time, text, backup = bubble_info[1], bubble_info[2], bubble_info[8]
  5472. local billboard, frame, label
  5473. if backup and false then
  5474. billboard = backup:Clone()
  5475. frame = billboard.Frame
  5476. label = frame.Label
  5477. bubble_info[5] = billboard
  5478. bubble_info[6] = frame
  5479. bubble_info[7] = label
  5480. billboard.Parent = Workspace
  5481. else
  5482. label = DrawMultilineTextNetwork(text, bubble_info[9], UDim2.new(0, 12, 0, 16), creation_time - time(), "Center")
  5483. label.Name = "Label"
  5484. label.Position = UDim2.new(0, 16, 0, 16)
  5485. billboard = Instance.new("BillboardGui", Workspace)
  5486. billboard.Adornee = chatAdornee
  5487. billboard.AlwaysOnTop = true
  5488. billboard.Size = UDim2.new(label.Size.X.Scale, label.Size.X.Offset + 32, label.Size.Y.Scale, label.Size.Y.Offset + 32)
  5489. billboard.SizeOffset = Vector2.new(0, 0)
  5490. billboard.StudsOffset = Vector3.new(0, 1, 0)
  5491. frame = Instance.new("Frame", billboard)
  5492. bubble_info[5] = billboard
  5493. bubble_info[6] = frame
  5494. bubble_info[7] = label
  5495. local background_color = bubble_info[10]
  5496. if type(background_color) == "function" then
  5497. background_color(bubble_info)
  5498. else
  5499. frame.BackgroundColor3 = background_color
  5500. end
  5501. frame.BackgroundTransparency = 0.3
  5502. frame.BorderSizePixel = 0
  5503. frame.ClipsDescendants = true
  5504. frame.Name = "Frame"
  5505. frame.Size = UDim2.new(1, 0, 0, 0)
  5506. label.Parent = frame
  5507. -- bubble_info[8] = billboard:Clone()
  5508. end
  5509. end
  5510. local tween_time = 0.3
  5511. function ConfigureChatBubble(bubble_info)
  5512. local creation_time, destruction_time, billboard, frame = bubble_info[1], bubble_info[3], bubble_info[5], bubble_info[6]
  5513. if not billboard or billboard.Parent ~= workspace then
  5514. CreateChatBubble(bubble_info)
  5515. billboard, frame = bubble_info[5], bubble_info[6]
  5516. end
  5517. if billboard.Adornee ~= chatAdornee then
  5518. billboard.Adornee = chatAdornee
  5519. end
  5520. local current_time = time()
  5521. local elapsed_time = current_time - creation_time
  5522. local remaining_time = destruction_time - current_time
  5523. if remaining_time < 0 then
  5524. bubble_info[4] = false
  5525. billboard:Destroy()
  5526. return false
  5527. elseif remaining_time < tween_time then
  5528. local tween_progress = math.sin(remaining_time * math.pi / (tween_time * 2))
  5529. frame.Size = UDim2.new(1, 0, tween_progress, 0)
  5530. elseif elapsed_time < tween_time then
  5531. local tween_progress = math.sin(elapsed_time * math.pi / (tween_time * 2))
  5532. frame.Size = UDim2.new(1, 0, tween_progress, 0)
  5533. elseif frame.Size ~= UDim2.new(1, 0, 1, 0) then
  5534. frame.Size = UDim2.new(1, 0, 1, 0)
  5535. end
  5536. return true
  5537. end
  5538. function ChatBubble.MainLoop()
  5539. local offset = 0
  5540. local removing = {}
  5541. for index, bubble_info in ipairs(chat_bubbles) do
  5542. if not ConfigureChatBubble(bubble_info) then
  5543. removing[#removing + 1] = index - #removing
  5544. else
  5545. local billboard, frame = bubble_info[5], bubble_info[6]
  5546. local billboard_h = billboard.Size.Y.Offset
  5547. local bubble_h = frame.Size.Y.Scale * billboard_h
  5548. offset = 8 + offset + bubble_h
  5549. billboard.SizeOffset = Vector2.new(0, offset / billboard_h - 0.5)
  5550. end
  5551. end
  5552. for index, bubble_index in ipairs(removing) do
  5553. table.remove(chat_bubbles, bubble_index)
  5554. end
  5555. RunService.Stepped:wait()
  5556. end
  5557. function WrapText(text, character_limit, line_length_limit)
  5558. if #text > character_limit then
  5559. text = string.sub(text, 1, character_limit - 3) .. "..."
  5560. end
  5561. local text_length = #text
  5562. local line_length = 0
  5563. local i = 0
  5564. while i <= text_length do
  5565. i = i + 1
  5566. local character = string.sub(text, i, i)
  5567. if character == "\t" then
  5568. local tabulation_size = 4 - line_length % 4
  5569. line_length = line_length + tabulation_size
  5570. if line_length >= line_length_limit then
  5571. tabulation_size = line_length - line_length_limit
  5572. line_length = 0
  5573. text_length = text_length + tabulation_size
  5574. text = string.sub(text, 1, i - 1) .. string.rep(" ", tabulation_size) .. "\n" .. string.sub(text, i + 1)
  5575. i = i + tabulation_size + 1
  5576. else
  5577. text_length = text_length + tabulation_size - 1
  5578. text = string.sub(text, 1, i - 1) .. string.rep(" ", tabulation_size) .. string.sub(text, i + 1)
  5579. i = i + tabulation_size - 1
  5580. end
  5581. elseif character == "\n" then
  5582. line_length = 0
  5583. else
  5584. line_length = line_length + 1
  5585. if line_length >= line_length_limit then
  5586. local k = i - line_length + 1
  5587. local success = false
  5588. for j = i, k, -1 do
  5589. if string.match(string.sub(text, j, j), "[ \t]") then
  5590. text = string.sub(text, 1, j - 1) .. "\n" .. string.sub(text, j + 1)
  5591. text_length = text_length + 1
  5592. success = true
  5593. break
  5594. end
  5595. end
  5596. if not success then
  5597. text = string.sub(text, 1, i) .. "\n" .. string.sub(text, i + 1)
  5598. text_length = text_length + 1
  5599. end
  5600. i = i + 1
  5601. line_length = 0
  5602. end
  5603. end
  5604. end
  5605. if #text > character_limit then
  5606. text = string.sub(text, 1, character_limit - 3) .. "..."
  5607. end
  5608. return text
  5609. end
  5610. function ChatBubble.Create(text, theme)
  5611. local text = WrapText(text, 200, 30)
  5612. local creation_time = time()
  5613. local bubble_info = {creation_time, text, creation_time + 6 + #text / 15, true}
  5614. local previousTheme
  5615. if theme then
  5616. previousTheme = ChatBubble.GetTheme()
  5617. ChatBubble.SetTheme(theme)
  5618. end
  5619. bubble_info[9] = ChatBubble.font
  5620. bubble_info[10] = ChatBubble.background_color
  5621. if previousTheme then
  5622. ChatBubble.SetTheme(previousTheme)
  5623. end
  5624. table.insert(chat_bubbles, 1, bubble_info)
  5625. end
  5626. TaskScheduler.Start(function()
  5627. while true do
  5628. ChatBubble.MainLoop()
  5629. end
  5630. end)
  5631. ]])
  5632. Module.Store("Fragmentation", [[
  5633. Fragmentation.AXIS_DATA = {
  5634. {"X", Vector3.new(1, 0, 0)},
  5635. {"Y", Vector3.new(0, 1, 0)},
  5636. {"Z", Vector3.new(0, 0, 1)}
  5637. }
  5638. function Fragmentation.DamageRegion(region, fragmentationSize, ignoreDescendantsInstance)
  5639. local parts = Workspace:FindPartsInRegion3(region, ignoreDescendantsInstance, 100)
  5640. local splitCount = 0
  5641. for _, part in ipairs(parts) do
  5642. if not Utility.SafeIsA(part, "Terrain") and Fragmentation.SplitPart(part, fragmentationSize) then
  5643. splitCount = splitCount + 1
  5644. end
  5645. end
  5646. return splitCount
  5647. end
  5648. function Fragmentation.DamageRay(ray, lengthMultiplier, fragmentationSizeFunction, ignoreDescendantsInstance)
  5649. local part, hitPoint
  5650. local rayDirection = ray.Direction
  5651. local shiftedRay = ray
  5652. for attemptCount = 1, lengthMultiplier do
  5653. part, hitPoint = Workspace:FindPartOnRay(shiftedRay, ignoreDescendantsInstance)
  5654. if part then
  5655. break
  5656. else
  5657. shiftedRay = Ray.new(shiftedRay.Origin + rayDirection, rayDirection)
  5658. end
  5659. end
  5660. if part then
  5661. if Utility.SafeIsA(part, "Terrain") then
  5662. local cellPosition = part:WorldToCellPreferSolid(hitPoint)
  5663. part:SetCell(cellPosition.X, cellPosition.Y, cellPosition.Y, Enum.CellMaterial.Empty, Enum.CellBlock.Solid, Enum.CellOrientation.X)
  5664. return true
  5665. else
  5666. return Fragmentation.SplitPart(part, fragmentationSizeFunction((hitPoint - ray.Origin).magnitude))
  5667. end
  5668. end
  5669. return false
  5670. end
  5671. function Fragmentation.SplitPart(part, fragmentationSize)
  5672. pcall(part.BreakJoints, part)
  5673. local isBlock = Utility.SafeIsA(part, "Part") and part.Shape == Enum.PartType.Block
  5674. local mass = part:GetMass()
  5675. local size = part.Size
  5676. if (isBlock and ((size.X < fragmentationSize and size.Y < fragmentationSize and size.Z < fragmentationSize)
  5677. or (not part.Anchored and mass < 750))) or (not isBlock and mass < 250000) then
  5678. pcall(Game.Destroy, part)
  5679. elseif isBlock then
  5680. local parts = {part}
  5681. part.FormFactor = Enum.FormFactor.Custom
  5682. local model = Instance.new("Model", part.Parent)
  5683. model.Name = "Fragments"
  5684. local partClone = Instance.new("Part")
  5685. -- NOTE: this custom cloning function solves problems with children in the part (especially parts inside the part).
  5686. -- surface inputs and parameters are ignored since fragmentation messes up the structure anyway.
  5687. -- formfactor is is ignored too because it should always be Custom for fragmentation.
  5688. -- shape is ignored too because block is default and it has already been established that the part is a block.
  5689. -- cframe is ignored too because it is set later on.
  5690. partClone.Anchored = part.Anchored
  5691. partClone.Archivable = part.Archivable
  5692. partClone.BackSurface = part.BackSurface
  5693. partClone.BottomSurface = part.BottomSurface
  5694. partClone.BrickColor = part.BrickColor
  5695. partClone.CanCollide = part.CanCollide
  5696. partClone.Elasticity = part.Elasticity
  5697. partClone.FormFactor = Enum.FormFactor.Custom
  5698. partClone.Friction = part.Friction
  5699. partClone.FrontSurface = part.FrontSurface
  5700. partClone.LeftSurface = part.LeftSurface
  5701. partClone.Locked = part.Locked
  5702. partClone.Material = part.Material
  5703. partClone.Reflectance = part.Reflectance
  5704. partClone.RightSurface = part.RightSurface
  5705. partClone.RotVelocity = part.RotVelocity
  5706. partClone.Size = part.Size
  5707. partClone.TopSurface = part.TopSurface
  5708. partClone.Transparency = part.Transparency
  5709. partClone.Velocity = part.Velocity
  5710. for _, data in ipairs(Fragmentation.AXIS_DATA) do
  5711. local axisName, axisNormal = data[1], data[2]
  5712. local axisSize = size[axisName]
  5713. if axisSize >= fragmentationSize then
  5714. size = (Vector3.new(1, 1, 1) - 0.5 * data[2]) * size
  5715. partClone.size = size
  5716. for partIndex = 1, #parts do
  5717. local part = parts[partIndex]
  5718. local cframe = part.CFrame
  5719. part.Size = size
  5720. local clone = partClone:Clone()
  5721. part.CFrame = cframe * CFrame.new((-0.25 * axisSize) * axisNormal)
  5722. clone.CFrame = cframe * CFrame.new((0.25 * axisSize) * axisNormal)
  5723. clone.Parent = model
  5724. parts[#parts + 1] = clone
  5725. end
  5726. end
  5727. end
  5728. for _, part in ipairs(parts) do
  5729. part:MakeJoints()
  5730. end
  5731. else
  5732. return false
  5733. end
  5734. return true
  5735. end
  5736. ]])
  5737. Module.Store("GraphicalEffects", [[
  5738. local MESH_IDS = {"rbxassetid://15310891"}
  5739. local SOUND_IDS = {"rbxassetid://2248511", "rbxassetid://1369158"}
  5740. local TEXTURE_IDS = {"rbxassetid://36527089", "rbxassetid://122610943", "rbxassetid://126561317", "rbxassetid://127033719"}
  5741. local preloadConnections = {}
  5742. local reloadingPreloads = false
  5743. function GraphicalEffects.InitPreloads()
  5744. local preload_part = Instance.new("Part")
  5745. GraphicalEffects.preload_part = preload_part
  5746. preload_part.Anchored = true
  5747. preload_part.Archivable = false
  5748. preload_part.BottomSurface = "Smooth"
  5749. preload_part.CanCollide = false
  5750. preload_part.CFrame = CFrame.new(math.huge, math.huge, math.huge)
  5751. preload_part.FormFactor = "Custom"
  5752. preload_part.Locked = true
  5753. preload_part.Name = "Asset Preloader"
  5754. preload_part.Size = Vector3.new(0.2, 0.2, 0.2)
  5755. preload_part.TopSurface = "Smooth"
  5756. preload_part.Transparency = 1
  5757. preloadConnections[preload_part] = preload_part.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged)
  5758. for _, mesh_id in ipairs(MESH_IDS) do
  5759. local mesh = Instance.new("SpecialMesh")
  5760. mesh.MeshType = "FileMesh"
  5761. mesh.MeshId = mesh_id
  5762. preloadConnections[mesh] = mesh.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged)
  5763. mesh.Parent = preload_part
  5764. end
  5765. for _, sound_id in ipairs(SOUND_IDS) do
  5766. local sound = Instance.new("Sound")
  5767. sound.SoundId = sound_id
  5768. sound.Volume = 0
  5769. preloadConnections[sound] = sound.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged)
  5770. sound.Parent = preload_part
  5771. end
  5772. for _, texture_id in ipairs(TEXTURE_IDS) do
  5773. local decal = Instance.new("Decal")
  5774. decal.Texture = texture_id
  5775. preloadConnections[decal] = decal.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged)
  5776. decal.Parent = preload_part
  5777. end
  5778. preload_part.Parent = Workspace
  5779. end
  5780. function GraphicalEffects.PreloadsAncestryChanged(child, parent)
  5781. if not reloadingPreloads and parent ~= GraphicalEffects.preload_part and parent ~= Workspace then
  5782. reloadingPreloads = true
  5783. for _, connection in pairs(preloadConnections) do
  5784. connection:disconnect()
  5785. preloadConnections[_] = nil
  5786. end
  5787. wait(1)
  5788. reloadingPreloads = false
  5789. GraphicalEffects.InitPreloads()
  5790. end
  5791. end
  5792. GraphicalEffects.InitPreloads()
  5793. -- Hyper beam
  5794. function GraphicalEffects.FireSpaceHyperBeam(target, power, duration, radius, height, deviation)
  5795. local stepTime, gameTime = 1 / 30, TaskScheduler.GetCurrentTime()
  5796. local frames = duration * 30
  5797. local beamColorOffset = 0.75 * tick() -- math.random()
  5798. local blastPressure = power * 62500 + 250000
  5799. local beamPart = Instance.new("Part")
  5800. local beamMesh = Instance.new("SpecialMesh", beamPart)
  5801. local explosion = Instance.new("Explosion")
  5802. local sound = Instance.new("Sound", beamPart)
  5803. beamPart.Anchored = true
  5804. beamPart.CanCollide = false
  5805. beamPart.CFrame = CFrame.new(target, target + Vector3.new(deviation * (math.random() - 0.5), deviation * (math.random() - 0.5), height))
  5806. beamPart.FormFactor = "Custom"
  5807. beamPart.Locked = true
  5808. beamPart.Size = Vector3.new(0.2, 0.2, 0.2)
  5809. beamMesh.MeshId = "rbxassetid://15310891"
  5810. beamMesh.MeshType = "FileMesh"
  5811. beamMesh.TextureId = "rbxassetid://36527089"
  5812. local beamGlowPart1 = beamPart:Clone()
  5813. local beamGlowMesh1 = beamMesh:Clone()
  5814. local beamGlowPart2 = beamPart:Clone()
  5815. local beamGlowMesh2 = beamMesh:Clone()
  5816. local beamLight = Instance.new("PointLight", beamPart)
  5817. beamLight.Range = power * 2
  5818. beamLight.Shadows = true
  5819. explosion.BlastPressure = blastPressure
  5820. explosion.BlastRadius = power
  5821. explosion.Position = target
  5822. sound.SoundId = "rbxassetid://2248511"
  5823. sound.Volume = 1
  5824. local explosionHitConnection = explosion.Hit:connect(function(part, distance)
  5825. if not part.Anchored and part:GetMass() < power * power then
  5826. pcall(part.BreakJoints, part)
  5827. part.Color = Color3.new(Utility.GetRainbowRGB(1.5 * gameTime + beamColorOffset))
  5828. end
  5829. end)
  5830. beamPart.Transparency = 0.5
  5831. beamPart.Archivable = false
  5832. beamGlowPart1.Transparency = 0.75
  5833. beamGlowPart2.Transparency = 0.75
  5834. beamGlowMesh1.Parent = beamGlowPart1
  5835. beamGlowPart1.Parent = beamPart
  5836. beamGlowMesh2.Parent = beamGlowPart2
  5837. beamGlowPart2.Parent = beamPart
  5838. beamPart.Parent = workspace
  5839. explosion.Parent = workspace
  5840. for frame = 1, frames do
  5841. local progress = frame / frames
  5842. local alpha = 1 - math.sin(0.5 * math.pi * progress)
  5843. local scale = 0.4 * alpha
  5844. local glowScale1 = alpha * (0.5 + 0.5 * math.sin(math.tau * (8 * gameTime + beamColorOffset)))
  5845. local glowScale2 = alpha * (0.5 + 0.5 * math.cos(math.tau * (8 * gameTime + beamColorOffset)))
  5846. local vertexColor = Vector3.new(Utility.GetRainbowRGB(1.5 * gameTime + beamColorOffset))
  5847. beamLight.Brightness = 1 - progress
  5848. beamLight.Color = Color3.new(vertexColor.x, vertexColor.y, vertexColor.z)
  5849. beamMesh.Scale = Vector3.new(radius * scale, 9000, radius * scale)
  5850. beamMesh.VertexColor = vertexColor
  5851. beamGlowMesh1.Scale = Vector3.new(1.2 * radius * glowScale1, 9000, 1.2 * radius * glowScale1)
  5852. beamGlowMesh1.VertexColor = vertexColor
  5853. beamGlowMesh2.Scale = Vector3.new(1.2 * radius * glowScale2, 9000, 1.2 * radius * glowScale2)
  5854. beamGlowMesh2.VertexColor = vertexColor
  5855. RunService.Stepped:wait()
  5856. gameTime = TaskScheduler.GetCurrentTime()
  5857. if frame <= 2 then
  5858. local explosion = Instance.new("Explosion")
  5859. explosion.BlastPressure = (1 - progress) * blastPressure
  5860. explosion.BlastRadius = (1 - progress) * power
  5861. explosion.Position = target
  5862. explosion.Parent = Workspace
  5863. if frame == 2 then
  5864. sound:Play()
  5865. end
  5866. end
  5867. end
  5868. pcall(beamPart.Destroy, beamPart)
  5869. explosionHitConnection:disconnect()
  5870. end
  5871. function GraphicalEffects.SpaceHyperBeam(target, power, duration, radius, height, deviation)
  5872. TaskScheduler.Start(GraphicalEffects.FireSpaceHyperBeam, target, power or 12, duration or 1.5, radius or 6, height or 600, deviation or 20)
  5873. end
  5874. -- Magic Circle
  5875. GraphicalEffects.magicCircleData = {}
  5876. GraphicalEffects.MAGIC_CIRCLE_DEFAULT_OFFSET = 6.25
  5877. function GraphicalEffects.AnimateMagicCircle(data)
  5878. local frame, direction, magic_circle_model, magic_circle_part, magic_circle_light, magic_circle_decal_back, magic_circle_decal_front, duration,
  5879.  
  5880. stay, magic_circle_adornee_func, magic_circle_offset = unpack(data)
  5881. frame = frame + 1
  5882. data[1] = frame
  5883. local transparency = (frame / duration) ^ stay
  5884. local opacity = 1 - transparency
  5885. if frame == duration then
  5886. pcall(Game.Destroy, magic_circle_model)
  5887. GraphicalEffects.magicCircleData[data] = nil
  5888. else
  5889. if magic_circle_model.Parent ~= Workspace then
  5890. pcall(Utility.SetProperty, magic_circle_model, "Parent", Workspace)
  5891. end
  5892. local magic_circle_adornee = magic_circle_adornee_func()
  5893. magic_circle_position = magic_circle_adornee.Position + direction * magic_circle_offset
  5894. local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, math.tau * frame /
  5895.  
  5896. 25)
  5897. magic_circle_part.CFrame = magic_circle_cframe
  5898. magic_circle_light.Brightness = opacity
  5899. magic_circle_decal_back.Transparency = transparency
  5900. magic_circle_decal_front.Transparency = transparency
  5901. end
  5902. end
  5903. function GraphicalEffects.CreateMagicCircle(target, magic_circle_scale, magic_circle_image, light_color, duration, stay, magic_circle_adornee_func,
  5904.  
  5905. magic_circle_offset)
  5906. local magic_circle_adornee = magic_circle_adornee_func()
  5907. if magic_circle_adornee then
  5908. local origin = magic_circle_adornee.Position
  5909. local direction = (target - origin).unit
  5910. local magic_circle_position = origin + direction * magic_circle_offset
  5911. local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction)
  5912. local magic_circle_model = Instance.new("Model")
  5913. local magic_circle_part = Instance.new("Part", magic_circle_model)
  5914. local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part)
  5915. local magic_circle_light = Instance.new("PointLight", magic_circle_part)
  5916. local magic_circle_decal_back = Instance.new("Decal", magic_circle_part)
  5917. local magic_circle_decal_front = Instance.new("Decal", magic_circle_part)
  5918. magic_circle_model.Archivable = false
  5919. magic_circle_part.Anchored = true
  5920. magic_circle_part.BottomSurface = "Smooth"
  5921. magic_circle_part.CanCollide = false
  5922. magic_circle_part.CFrame = magic_circle_cframe
  5923. magic_circle_part.FormFactor = "Custom"
  5924. magic_circle_part.Locked = true
  5925. magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2)
  5926. magic_circle_part.TopSurface = "Smooth"
  5927. magic_circle_part.Transparency = 1
  5928. magic_circle_mesh.Scale = Vector3.new(60, 60, 0) * magic_circle_scale
  5929. magic_circle_light.Color = light_color
  5930. magic_circle_light.Range = 16 * magic_circle_scale
  5931. magic_circle_light.Shadows = true
  5932. magic_circle_decal_back.Face = "Back"
  5933. magic_circle_decal_back.Texture = magic_circle_image
  5934. magic_circle_decal_front.Face = "Front"
  5935. magic_circle_decal_front.Texture = magic_circle_image
  5936. magic_circle_model.Parent = Workspace
  5937. local data = {0, direction, magic_circle_model, magic_circle_part, magic_circle_light, magic_circle_decal_back, magic_circle_decal_front,
  5938.  
  5939. duration, stay, magic_circle_adornee_func, magic_circle_offset}
  5940. GraphicalEffects.magicCircleData[data] = true
  5941. return data
  5942. end
  5943. end
  5944. -- Laser of Death
  5945. GraphicalEffects.LASER_WIDTH = 0.15
  5946. GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE = 6.25
  5947. GraphicalEffects.laser_data = {}
  5948. --GraphicalEffects.fragmentation = {}
  5949. function GraphicalEffects.AnimateLaserOfDeath(data)
  5950. local frame, directionOrientation, direction, magic_circle_model, laser_part, laser_mesh, magic_circle_part, magic_circle_light,
  5951.  
  5952. magic_circle_decal_back, magic_circle_decal_front, sound, laser_scale, fragmentation_size, duration, laser_lights, laser_effects, stay, light_effects =
  5953.  
  5954. unpack(data)
  5955. local laser_color = laser_part.Color
  5956. frame = frame + 1
  5957. data[1] = frame
  5958. local transparency = (frame / duration) ^ stay
  5959. local opacity = 1 - transparency
  5960. if frame == 2 then
  5961. sound:Play()
  5962. end
  5963. if frame == duration then
  5964. pcall(Game.Destroy, magic_circle_model)
  5965. GraphicalEffects.laser_data[data] = nil
  5966. else
  5967. if magic_circle_model.Parent ~= Workspace then
  5968. pcall(Utility.SetProperty, magic_circle_model, "Parent", Workspace)
  5969. end
  5970. local laser_distance = 0
  5971. local origin = chatAdornee.CFrame
  5972. if not light_effects then
  5973. direction = (origin * directionOrientation - origin.p).unit
  5974. end
  5975. local magic_circle_position = origin.p + direction * GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE
  5976. local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, math.tau * frame /
  5977.  
  5978. 25)
  5979. local loop_scale = (laser_scale - 1) / 10
  5980. for x_offset = -loop_scale, loop_scale, 2 do
  5981. for y_offset = -loop_scale, loop_scale, 2 do
  5982. local origin_position = magic_circle_cframe * Vector3.new(x_offset, y_offset, 0)
  5983. for index = 1, 8 do
  5984. local part, position
  5985. for ray_index = 1, 10 do
  5986. local ray = Ray.new(origin_position + direction * (999 * (ray_index - 1)), direction * 999)
  5987. part, position = Workspace:FindPartOnRay(ray, magic_circle_model)
  5988. if part then
  5989. break
  5990. end
  5991. end
  5992. if part then
  5993. laser_distance = (position - origin_position).magnitude
  5994. if frame % 8 == 1 and index == 1 then
  5995. Instance.new("Explosion", Workspace).Position = position
  5996. end
  5997. if not part:IsA("Terrain") then
  5998. pcall(part.BreakJoints, part)
  5999. local is_block = part:IsA("Part") and part.Shape == Enum.PartType.Block
  6000. local mass = part:GetMass()
  6001. local size = part.Size
  6002. if (is_block and ((size.X < fragmentation_size and size.Y < fragmentation_size and size.Z <
  6003.  
  6004. fragmentation_size) or (not part.Anchored and mass < 750))) or (not is_block and mass < 250000) then
  6005. local part_transparency = math.max(part.Transparency + 0.007 * fragmentation_size, 0.5)
  6006. if part_transparency >= 0.5 then -- temporarily to minimize debris
  6007. pcall(Game.Destroy, part)
  6008. else
  6009. local cframe = part.CFrame
  6010. part.Anchored = false
  6011. part.BrickColor = BrickColor.new("Medium stone grey")
  6012. part.CanCollide = true
  6013. if part:IsA("FormFactorPart") then
  6014. part.FormFactor = "Custom"
  6015. end
  6016. part.Size = size - Vector3.new(0.135, 0.135, 0.135) * fragmentation_size
  6017. part.Transparency = part_transparency
  6018. part.CFrame = cframe + direction * 5
  6019. part.Velocity = part.Velocity + direction * 40
  6020. end
  6021. elseif is_block then
  6022. local parts = {part}
  6023. local model = Instance.new("Model", part.Parent)
  6024. model.Name = "Fragments"
  6025. if size.X >= fragmentation_size then
  6026. size = Vector3.new(0.5, 1, 1) * size
  6027. local archivable = part.Archivable
  6028. local cframe = part.CFrame
  6029. part.FormFactor = "Custom"
  6030. part.Size = size
  6031. part.Archivable = true
  6032. local part_clone = part:Clone()
  6033. part.Archivable = archivable
  6034. part_clone.Archivable = archivable
  6035. part.CFrame = cframe * CFrame.new(-0.5 * size.X, 0, 0)
  6036. part_clone.CFrame = cframe * CFrame.new(0.5 * size.X, 0, 0)
  6037. part_clone.Parent = model
  6038. parts[2] = part_clone
  6039. end
  6040. if size.Y >= fragmentation_size then
  6041. size = Vector3.new(1, 0.5, 1) * size
  6042. for part_index = 1, #parts do
  6043. local part = parts[part_index]
  6044. local archivable = part.Archivable
  6045. local cframe = part.CFrame
  6046. part.FormFactor = "Custom"
  6047. part.Size = size
  6048. part.Archivable = true
  6049. local part_clone = part:Clone()
  6050. part.Archivable = archivable
  6051. part_clone.Archivable = archivable
  6052. part.CFrame = cframe * CFrame.new(0, -0.5 * size.Y, 0)
  6053. part_clone.CFrame = cframe * CFrame.new(0, 0.5 * size.Y, 0)
  6054. part_clone.Parent = model
  6055. table.insert(parts, part_clone)
  6056. end
  6057. end
  6058. if size.Z >= fragmentation_size then
  6059. size = Vector3.new(1, 1, 0.5) * size
  6060. for part_index = 1, #parts do
  6061. local part = parts[part_index]
  6062. local archivable = part.Archivable
  6063. local cframe = part.CFrame
  6064. part.FormFactor = "Custom"
  6065. part.Size = size
  6066. part.Archivable = true
  6067. local part_clone = part:Clone()
  6068. part.Archivable = archivable
  6069. part_clone.Archivable = archivable
  6070. part.CFrame = cframe * CFrame.new(0, 0, -0.5 * size.Z)
  6071. part_clone.CFrame = cframe * CFrame.new(0, 0, 0.5 * size.Z)
  6072. part_clone.Parent = model
  6073. table.insert(parts, part_clone)
  6074. end
  6075. end
  6076. for _, part in ipairs(parts) do
  6077. part:MakeJoints()
  6078. end
  6079. else
  6080. break
  6081. end
  6082. end
  6083. else
  6084. laser_distance = 9990
  6085. break
  6086. end
  6087. end
  6088. end
  6089. end
  6090. local laser_cframe = magic_circle_cframe * CFrame.Angles(-0.5 * math.pi, 0, 0)
  6091. local laser_width = GraphicalEffects.LASER_WIDTH * opacity * laser_scale
  6092. local laser_mesh_offset = Vector3.new(0, 0.5 * laser_distance, 0)
  6093. laser_part.CFrame = laser_cframe
  6094. if laser_effects then
  6095. local laser_effect_data_1, laser_effect_data_2 = laser_effects[1], laser_effects[2]
  6096. local laser_effect_1, laser_effect_mesh_1 = laser_effect_data_1[1], laser_effect_data_1[2]
  6097. local laser_effect_2, laser_effect_mesh_2 = laser_effect_data_2[1], laser_effect_data_2[2]
  6098. laser_effect_1.CFrame = laser_cframe
  6099. laser_effect_2.CFrame = laser_cframe
  6100. laser_effect_mesh_1.Offset = laser_mesh_offset
  6101. laser_effect_mesh_2.Offset = laser_mesh_offset
  6102. local game_time = time()
  6103. local effect_scale_1 = 0.5 + 0.5 * math.sin(16 * math.pi * game_time)
  6104. local effect_scale_2 = 0.5 + 0.5 * math.cos(16 * math.pi * game_time)
  6105. laser_effect_mesh_1.Scale = 5 * Vector3.new(laser_width * effect_scale_1, laser_distance, laser_width * effect_scale_1)
  6106. laser_effect_mesh_2.Scale = 5 * Vector3.new(laser_width * effect_scale_2, laser_distance, laser_width * effect_scale_2)
  6107. laser_width = laser_width * 0.25
  6108. end
  6109. laser_mesh.Offset = laser_mesh_offset
  6110. laser_mesh.Scale = 5 * Vector3.new(laser_width, laser_distance, laser_width)
  6111. magic_circle_part.CFrame = magic_circle_cframe
  6112. magic_circle_light.Brightness = opacity
  6113. magic_circle_decal_back.Transparency = transparency
  6114. magic_circle_decal_front.Transparency = transparency
  6115. if light_effects then
  6116. for index, data in ipairs(laser_lights) do
  6117. local laser_spotlight_part, laser_spotlight = data[1], data[2]
  6118. local laser_spotlight_offset = 30 * (index - 1)
  6119. if laser_spotlight_offset <= laser_distance then
  6120. laser_spotlight_part.CFrame = magic_circle_cframe * CFrame.new(0, 0, -laser_spotlight_offset)
  6121. laser_spotlight.Brightness = opacity
  6122. laser_spotlight.Enabled = true
  6123. else
  6124. laser_spotlight.Enabled = false
  6125. end
  6126. end
  6127. end
  6128. end
  6129. end
  6130. function GraphicalEffects.ShootLaserOfDeath(target, data)
  6131. if chatAdornee then
  6132. data = data or {}
  6133. local brickcolor = data.brickcolor or BrickColor.new("Really black")
  6134. local duration = data.duration or 40
  6135. local fragmentation_size = data.fragmentation_size or 3
  6136. local laser_scale = data.laser_scale or 1
  6137. local light_color = data.light_color or Color3.new(1, 0.5, 1)
  6138. local magic_circle_image = data.magic_circle_image or "rbxassetid://122610943"
  6139. local magic_circle_scale = data.magic_circle_scale or 1
  6140. local sound_volume = data.sound_volume or 1 / 3
  6141. local special_effects = data.special_effects
  6142. local stay = data.stay or 4
  6143. local origin = chatAdornee.CFrame
  6144. local directionOrientation = origin:pointToObjectSpace(target)
  6145. local direction = (target - origin.p).unit
  6146. local magic_circle_position = origin.p + direction * GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE
  6147. local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction)
  6148. local magic_circle_model = Instance.new("Model")
  6149. local laser_part = Instance.new("Part", magic_circle_model)
  6150. local laser_mesh = Instance.new("CylinderMesh", laser_part)
  6151. local magic_circle_part = Instance.new("Part", magic_circle_model)
  6152. local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part)
  6153. local magic_circle_light = Instance.new("PointLight", magic_circle_part)
  6154. local magic_circle_decal_back = Instance.new("Decal", magic_circle_part)
  6155. local magic_circle_decal_front = Instance.new("Decal", magic_circle_part)
  6156. local sound = Instance.new("Sound", magic_circle_part)
  6157. sound.Pitch = 1.25
  6158. sound.SoundId = "rbxassetid://2248511"
  6159. sound.Volume = sound_volume
  6160. magic_circle_model.Archivable = false
  6161. laser_part.Anchored = true
  6162. laser_part.BottomSurface = "Smooth"
  6163. laser_part.BrickColor = brickcolor
  6164. laser_part.CanCollide = false
  6165. laser_part.CFrame = magic_circle_cframe * CFrame.Angles(-0.5 * math.pi, 0, 0)
  6166. laser_part.FormFactor = "Custom"
  6167. laser_part.Locked = true
  6168. laser_part.Size = Vector3.new(0.2, 0.2, 0.2)
  6169. laser_part.TopSurface = "Smooth"
  6170. laser_mesh.Offset = Vector3.new(0, 0, 0)
  6171. laser_mesh.Name = "Mesh"
  6172. laser_mesh.Scale = 5 * laser_scale * Vector3.new(GraphicalEffects.LASER_WIDTH, 0, GraphicalEffects.LASER_WIDTH)
  6173. magic_circle_part.Anchored = true
  6174. magic_circle_part.BottomSurface = "Smooth"
  6175. magic_circle_part.CanCollide = false
  6176. magic_circle_part.CFrame = magic_circle_cframe
  6177. magic_circle_part.FormFactor = "Custom"
  6178. magic_circle_part.Locked = true
  6179. magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2)
  6180. magic_circle_part.TopSurface = "Smooth"
  6181. magic_circle_part.Transparency = 1
  6182. magic_circle_mesh.Scale = Vector3.new(60, 60, 0) * magic_circle_scale
  6183. magic_circle_light.Color = light_color
  6184. magic_circle_light.Range = 16 * magic_circle_scale
  6185. magic_circle_light.Shadows = true
  6186. magic_circle_decal_back.Face = "Back"
  6187. magic_circle_decal_back.Texture = magic_circle_image
  6188. magic_circle_decal_front.Face = "Front"
  6189. magic_circle_decal_front.Texture = magic_circle_image
  6190. magic_circle_model.Parent = Workspace
  6191. local laser_color = brickcolor.Color
  6192. local laser_lights = {}
  6193. local light_effects = laser_color.r + laser_color.g + laser_color.b > 0.25
  6194. if light_effects then
  6195. local laser_spotlight_part_template = Instance.new("Part")
  6196. local laser_spotlight_light_template = Instance.new("SpotLight", laser_spotlight_part_template)
  6197. laser_spotlight_part_template.Anchored = true
  6198. laser_spotlight_part_template.Anchored = true
  6199. laser_spotlight_part_template.BottomSurface = "Smooth"
  6200. laser_spotlight_part_template.CanCollide = false
  6201. laser_spotlight_part_template.FormFactor = "Custom"
  6202. laser_spotlight_part_template.Locked = true
  6203. laser_spotlight_part_template.Size = Vector3.new(0.2, 0.2, 0.2)
  6204. laser_spotlight_part_template.TopSurface = "Smooth"
  6205. laser_spotlight_part_template.Transparency = 1
  6206. laser_spotlight_light_template.Angle = 45
  6207. laser_spotlight_light_template.Color = laser_color
  6208. laser_spotlight_light_template.Enabled = true
  6209. laser_spotlight_light_template.Name = "Light"
  6210. laser_spotlight_light_template.Range = 60
  6211. for index = 1, 40 do
  6212. local laser_spotlight_part = laser_spotlight_part_template:Clone()
  6213. laser_spotlight_part.CFrame = magic_circle_cframe * CFrame.new(0, 0, -30 * (index - 1))
  6214. laser_spotlight_part.Parent = magic_circle_model
  6215. laser_lights[index] = {laser_spotlight_part, laser_spotlight_part.Light}
  6216. end
  6217. end
  6218. local laser_effects
  6219. if special_effects then
  6220. laser_effects = {}
  6221. local laser_effect_1 = laser_part:Clone()
  6222. laser_effect_1.BrickColor = special_effects
  6223. laser_effect_1.Transparency = 0.5
  6224. local laser_effect_2 = laser_effect_1:Clone()
  6225. laser_effects[1], laser_effects[2] = {laser_effect_1, laser_effect_1.Mesh}, {laser_effect_2, laser_effect_2.Mesh}
  6226. laser_effect_1.Parent = magic_circle_model
  6227. laser_effect_2.Parent = magic_circle_model
  6228. end
  6229. GraphicalEffects.laser_data[{0, directionOrientation, direction, magic_circle_model, laser_part, laser_mesh, magic_circle_part,
  6230.  
  6231. magic_circle_light, magic_circle_decal_back, magic_circle_decal_front, sound, laser_scale, fragmentation_size, duration, laser_lights, laser_effects, stay,
  6232.  
  6233. light_effects}] = true
  6234. end
  6235. end
  6236. -- Sapient Rock
  6237. function GraphicalEffects.SpawnSapientRock(position)
  6238. local part = Instance.new("Part", Workspace)
  6239. local size = 8 + math.random(0, 5)
  6240. part.BottomSurface = "Smooth"
  6241. part.TopSurface = "Smooth"
  6242. part.Material = "Slate"
  6243. part.Locked = true
  6244. part.Shape = "Ball"
  6245. part.FormFactor = "Custom"
  6246. part.Size = Vector3.new(size, size, size)
  6247. part.Position = position
  6248. local bodypos = Instance.new("BodyPosition", part)
  6249. bodypos.maxForce = Vector3.new(0, 0, 0)
  6250. local angry = false
  6251. local damage_ready = true
  6252. local torso_following
  6253. local torso_changed = -1000
  6254. local touched_conn = part.Touched:connect(function(hit)
  6255. local character = hit.Parent
  6256. if character then
  6257. local humanoid
  6258. for _, child in ipairs(character:GetChildren()) do
  6259. if child:IsA("Humanoid") then
  6260. humanoid = child
  6261. break
  6262. end
  6263. end
  6264. if humanoid then
  6265. if angry then
  6266. if damage_ready then
  6267. damage_ready = false
  6268. humanoid:TakeDamage(100)
  6269. wait(1)
  6270. damage_ready = true
  6271. angry = false
  6272. part.BrickColor = BrickColor.new("Medium stone grey")
  6273. end
  6274. else
  6275. local torso = humanoid.Torso
  6276. if torso then
  6277. torso_following = torso
  6278. torso_changed = tick()
  6279. end
  6280. end
  6281. end
  6282. end
  6283. end)
  6284. TaskScheduler.Start(function()
  6285. while part.Parent == Workspace do
  6286. if torso_following then
  6287. bodypos.position = torso_following.Position
  6288. if tick() - torso_changed > 60 or not torso_following.Parent then
  6289. torso_following = nil
  6290. bodypos.maxForce = Vector3.new(0, 0, 0)
  6291. angry = false
  6292. part.BrickColor = BrickColor.new("Medium stone grey")
  6293. else
  6294. local speed = angry and Vector3.new(16, 16, 16) or Vector3.new(6, 0, 6)
  6295. bodypos.maxForce = part:GetMass() * speed
  6296. if part.Position.Y < -250 then
  6297. part.Velocity = Vector3.new()
  6298. part.Position = torso_following.Position + Vector3.new(0, 80, 0)
  6299. part.BrickColor = BrickColor.new("Bright red")
  6300. angry = true
  6301. torso_changed = tick()
  6302. end
  6303. end
  6304. end
  6305. RunService.Stepped:wait()
  6306. end
  6307. touched_conn:disconnect()
  6308. end)
  6309. TaskScheduler.Start(function()
  6310. while part.Parent == Workspace do
  6311. wait(25 + math.random() * 10)
  6312. local next_size = 8 + math.random() * 5
  6313. if math.random(100) == 1 then
  6314. next_size = next_size * (2 + 6 * math.random())
  6315. end
  6316. next_size = math.floor(next_size + 0.5)
  6317. local start_time = tick()
  6318. local mesh = Instance.new("SpecialMesh", part)
  6319. mesh.MeshType = "Sphere"
  6320. repeat
  6321. local elapsed_time = tick() - start_time
  6322. local alpha = math.cos(elapsed_time * math.pi * 0.5)
  6323. local interpolated_size = size * alpha + next_size * (1 - alpha)
  6324. local size_vector = Vector3.new(interpolated_size, interpolated_size, interpolated_size)
  6325. local cframe = part.CFrame
  6326. part.Size = size_vector
  6327. part.CFrame = cframe
  6328. mesh.Scale = size_vector / part.Size
  6329. RunService.Stepped:wait()
  6330. until tick() - start_time >= 1
  6331. mesh:Destroy()
  6332. local cframe = part.CFrame
  6333. part.Size = Vector3.new(next_size, next_size, next_size)
  6334. part.CFrame = cframe
  6335. size = next_size
  6336. end
  6337. end)
  6338. end
  6339. -- Crystal ring
  6340. function GraphicalEffects.CrystalRing(data)
  6341. data = data or {}
  6342. local crystal_count = data.crystal_count or 10
  6343. local crystal_color = data.crystal_color or BrickColor.new("Bright red")
  6344. local crystal_scale = data.crystal_scale or Vector3.new(2 / 3, 2, 2 / 3)
  6345. local radius = radius or 1.25 * crystal_count / math.pi
  6346. local spawn_duration = data.spawn_duration or 0.065
  6347. local full_spawn_duration = spawn_duration * crystal_count
  6348. local float_duration = data.float_duration or 5
  6349. local wave_amplitude = data.wave_amplitude or 0.5
  6350. local wave_period = data.wave_period or 1
  6351. local appear_duration = data.appear_duration or 0.1
  6352. local disappear_duration = data.disappear_duration or 0.5
  6353. local base_part = data.base_part
  6354. local offset_cframe
  6355. if data.position then
  6356. offset_cframe = CFrame.new(data.position)
  6357. if base_part then
  6358. offset_cframe = base_part.CFrame:toObjectSpace(offset_cframe)
  6359. end
  6360. else
  6361. offset_cframe = CFrame.new()
  6362. end
  6363. local crystal_template = Instance.new("Part")
  6364. crystal_template.Anchored = true
  6365. crystal_template.Locked = true
  6366. crystal_template.CanCollide = false
  6367. crystal_template.BottomSurface = "Smooth"
  6368. crystal_template.TopSurface = "Smooth"
  6369. crystal_template.BrickColor = crystal_color
  6370. crystal_template.FormFactor = "Symmetric"
  6371. crystal_template.Size = Vector3.new(1, 1, 1)
  6372. local crystal_light = Instance.new("PointLight", crystal_template)
  6373. crystal_light.Brightness = 0.1 / crystal_count
  6374. crystal_light.Color = crystal_color.Color
  6375. crystal_light.Name = "Light"
  6376. crystal_light.Range = radius
  6377. crystal_light.Shadows = true
  6378. local crystal_mesh = Instance.new("SpecialMesh", crystal_template)
  6379. crystal_mesh.MeshId = "rbxassetid://9756362"
  6380. crystal_mesh.MeshType = "FileMesh"
  6381. crystal_mesh.Name = "Mesh"
  6382. crystal_mesh.Scale = crystal_scale
  6383. local crystal_model = Instance.new("Model")
  6384. crystal_model.Archivable = false
  6385. crystal_model.Name = "Crystal Model"
  6386. crystal_model.Parent = Workspace
  6387. local crystals = {}
  6388. local lights = {}
  6389. local meshes = {}
  6390. for index = 1, crystal_count do
  6391. local crystal = crystal_template:Clone()
  6392. crystal.Parent = crystal_model
  6393. crystals[index] = crystal
  6394. lights[index] = crystal.Light
  6395. meshes[index] = crystal.Mesh
  6396. end
  6397. local start_time = tick()
  6398. repeat
  6399. local base_cframe = offset_cframe
  6400. if base_part then
  6401. base_cframe = base_part.CFrame * base_cframe
  6402. end
  6403. local elapsed_time = tick() - start_time
  6404. for index, crystal in ipairs(crystals) do
  6405. local crystal_time = elapsed_time - index * spawn_duration
  6406. local disappear_time = crystal_time - float_duration
  6407. local offset
  6408. if crystal_time < 0 then
  6409. offset = 0
  6410. elseif crystal_time < appear_duration then
  6411. offset = radius * crystal_time / appear_duration
  6412. else
  6413. offset = radius
  6414. end
  6415. local wave_offset
  6416. if disappear_time >= 0 then
  6417. local disappear_progress = disappear_time / disappear_duration
  6418. if disappear_progress > 1 then
  6419. if crystal.Parent then
  6420. crystal:Destroy()
  6421. end
  6422. else
  6423. local inverse_progress = 1 - disappear_progress
  6424. local light = lights[index]
  6425. local mesh = meshes[index]
  6426. crystal.BrickColor = BrickColor.new("Really black")
  6427. light.Brightness = 2 * inverse_progress
  6428. light.Range = 2 * radius
  6429. mesh.Scale = crystal_scale * inverse_progress
  6430. end
  6431. wave_offset = 0
  6432. else
  6433. wave_offset = wave_amplitude * math.sin(math.tau * (elapsed_time - index / crystal_count * 3) / wave_period)
  6434. end
  6435. local rotation_angle = (tick() * 0.5 + (index - 1) / crystal_count) % 1 * math.tau
  6436. crystal.CFrame = base_cframe * CFrame.Angles(0, rotation_angle, 0) * CFrame.new(0, wave_offset, -offset)
  6437. end
  6438. RunService.Stepped:wait()
  6439. until elapsed_time >= float_duration + full_spawn_duration + disappear_duration
  6440. if crystal_model.Parent then
  6441. crystal_model:Destroy()
  6442. end
  6443. end
  6444. -- Missiles
  6445. GraphicalEffects.missileData = {}
  6446. GraphicalEffects.missileParts = {}
  6447. function GraphicalEffects.AnimateMissile(data)
  6448. local frame, missilePart, targetPart, timeCreated, direction, touchedConnection, explodeRequested, bodyGyro, swooshSound, magicCircleData, lifeTime,
  6449.  
  6450. pointOnPart, flipped = unpack(data)
  6451. frame = frame + 1
  6452. data[1] = frame
  6453. if flipped then
  6454. direction = -direction
  6455. end
  6456. if frame <= 10 then
  6457. if frame == 2 then
  6458. swooshSound:Play()
  6459. end
  6460. missilePart.Anchored = true
  6461. local progress = frame / 10
  6462. missilePart.Size = Vector3.new(1, 1, progress * 4)
  6463. local magicCirclePart = magicCircleData[4]
  6464. local magicCirclePosition = magicCirclePart.Position
  6465. local missileOffset = 2 * progress * direction
  6466. local missilePosition = magicCirclePosition + missileOffset
  6467. missilePart.CFrame = CFrame.new(missilePosition, missilePosition + direction)
  6468. --missilePart.Transparency = 0.5 * (1 - progress)
  6469. if frame == 10 then
  6470. touchedConnection = missilePart.Touched:connect(function(hit)
  6471. if hit.CanCollide and hit.Parent and not GraphicalEffects.missileParts[hit] then
  6472. touchedConnection:disconnect()
  6473. data[7] = true
  6474. end
  6475. end)
  6476. data[6] = touchedConnection
  6477. end
  6478. else
  6479. missilePart.Anchored = false
  6480. local missilePosition = missilePart.Position
  6481. local targetPosition = targetPart.CFrame * pointOnPart
  6482. local distanceVector = targetPosition - missilePosition
  6483. local elapsedTime = time() - timeCreated
  6484. local targetParent = targetPart.Parent
  6485. if explodeRequested or (targetParent and distanceVector.magnitude < 10) or elapsedTime > lifeTime then
  6486. GraphicalEffects.missileData[data] = nil
  6487. GraphicalEffects.missileParts[missilePart] = nil
  6488. touchedConnection:disconnect()
  6489. if missilePart.Parent then
  6490. missilePart:Destroy()
  6491. local explosion = Instance.new("Explosion")
  6492. explosion.BlastRadius = 12.5
  6493. explosion.Position = missilePosition
  6494. local explosionHitConnection = explosion.Hit:connect(function(hit, distance)
  6495. local missileData = GraphicalEffects.missileParts[hit]
  6496. if missileData and distance < 3 then
  6497. missileData[7] = true
  6498. else
  6499. pcall(hit.BreakJoints, hit)
  6500. end
  6501. end)
  6502. explosion.Parent = Workspace
  6503. TaskScheduler.Schedule(1, explosionHitConnection.disconnect, explosionHitConnection)
  6504. end
  6505. else
  6506. local targetInWorkspace = targetPart:IsDescendantOf(Workspace)
  6507. if targetInWorkspace then
  6508. direction = distanceVector.unit
  6509. data[5] = direction
  6510. end
  6511. local speed = 14 + elapsedTime * 10
  6512. local gyroD
  6513. if elapsedTime < 42.5 and targetInWorkspace then
  6514. gyroD = 1000 - elapsedTime * 15
  6515. else
  6516. gyroD = 100
  6517. bodyGyro.maxTorque = Vector3.new(0, 0, 0)
  6518. if elapsedTime + 7.5 < lifeTime then
  6519. data[11] = elapsedTime + 7.5
  6520. end
  6521. end
  6522. bodyGyro.D = gyroD
  6523. bodyGyro.cframe = CFrame.new(Vector3.new(), direction)
  6524. missilePart.Velocity = missilePart.CFrame.lookVector * speed
  6525. end
  6526. end
  6527. end
  6528. function GraphicalEffects.ShootMissile(targetPart, pointOnPart, direction, magic_circle_adornee_func, magic_circle_offset, flipped)
  6529. if not magic_circle_offset then
  6530. magic_circle_offset = GraphicalEffects.MAGIC_CIRCLE_DEFAULT_OFFSET
  6531. end
  6532. local targetPosition = targetPart.Position
  6533. local headPosition = chatAdornee.Position
  6534. local origin = CFrame.new(headPosition, headPosition + direction) + direction * magic_circle_offset
  6535. local missilePart = Instance.new("Part")
  6536. local antiGravityForce = Instance.new("BodyForce", missilePart)
  6537. local bodyGyro = Instance.new("BodyGyro", missilePart)
  6538. local explosionSound = Instance.new("Sound", missilePart)
  6539. local swooshSound = Instance.new("Sound", missilePart)
  6540. antiGravityForce.force = Vector3.new(0, 196.2 * 4, 0)
  6541. bodyGyro.D = 1000
  6542. bodyGyro.maxTorque = Vector3.new(1, 1, 1)
  6543. explosionSound.PlayOnRemove = true
  6544. explosionSound.SoundId = "rbxasset://sounds/collide.wav"
  6545. explosionSound.Volume = 1
  6546. missilePart.Anchored = true
  6547. missilePart.BackSurface = "Studs"
  6548. missilePart.BottomSurface = "Studs"
  6549. missilePart.BrickColor = BrickColor.Red()
  6550. missilePart.CFrame = origin
  6551. missilePart.FormFactor = "Custom"
  6552. missilePart.FrontSurface = "Studs"
  6553. missilePart.LeftSurface = "Studs"
  6554. missilePart.Locked = true
  6555. missilePart.RightSurface = "Studs"
  6556. missilePart.Size = Vector3.new(1, 1, 0.2)
  6557. missilePart.TopSurface = "Studs"
  6558. --missilePart.Transparency = 0.5
  6559. swooshSound.Looped = true
  6560. swooshSound.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav"
  6561. swooshSound.Volume = 0.7
  6562. local magicCircleData = GraphicalEffects.CreateMagicCircle(headPosition + direction * 1000, 0.875, "rbxassetid://127033719", Color3.new(1, 1, 1),
  6563.  
  6564. 40, 4, magic_circle_adornee_func or function() return chatAdornee end, magic_circle_offset)
  6565. local data = {0, missilePart, targetPart, time(), direction, false, false, bodyGyro, swooshSound, magicCircleData, 50, pointOnPart, flipped}
  6566. missilePart.Parent = Workspace
  6567. GraphicalEffects.missileData[data] = true
  6568. GraphicalEffects.missileParts[missilePart] = data
  6569. end
  6570. -- Joint crap
  6571. function GraphicalEffects.CubicInterpolate(y0, y1, y2, y3, mu)
  6572. local a0, a1, a2, a3, mu2
  6573. mu2 = mu * mu
  6574. a0 = y3 - y2 - y0 + y1
  6575. a1 = y0 - y1 - a0
  6576. a2 = y2 - y0
  6577. a3 = y1
  6578. return a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3
  6579. end
  6580. function GraphicalEffects.JointCrap(model, cycletime)
  6581. if model then
  6582. local cycletime = cycletime or (0.75 * (1 + math.random() * 4))
  6583. local offsetradius = 0.75
  6584. local rotationoffset = math.pi
  6585. local joints = {}
  6586. local stack = model:GetChildren()
  6587. while #stack ~= 0 do
  6588. local object = stack[#stack]
  6589. table.remove(stack)
  6590. for index, child in ipairs(object:GetChildren()) do
  6591. table.insert(stack, child)
  6592. end
  6593. if object:IsA("JointInstance") then
  6594. table.insert(joints, object)
  6595. end
  6596. end
  6597. local rot0 = {}
  6598. local rot1 = {}
  6599. local rot2 = {}
  6600. local rot3 = {}
  6601. local rot4 = {}
  6602. for index, joint in ipairs(joints) do
  6603. local pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius
  6604. local rot = Vector3.new(math.random(), math.random(), math.random()) * rotationoffset
  6605. rot0[index] = {joint.C0, joint.C1}
  6606. rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau))
  6607. rot2[index] = {pos, rot}
  6608. pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius
  6609. rot = rot + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset
  6610. rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau))
  6611. rot3[index] = {pos, rot}
  6612. pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius
  6613. rot = rot + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset
  6614. rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau))
  6615. rot4[index] = {pos, rot}
  6616. end
  6617. while model.Parent do
  6618. for i, j in ipairs(joints) do
  6619. local pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius
  6620. local rot = rot4[i][2] + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset
  6621. rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau))
  6622. rot1[i], rot2[i], rot3[i], rot4[i] = rot2[i], rot3[i], rot4[i], {pos, rot}
  6623. end
  6624. local start = tick()
  6625. while true do
  6626. local ctime = tick()
  6627. local elapsed = ctime - start
  6628. if elapsed > cycletime then
  6629. break
  6630. end
  6631. local progress = elapsed / cycletime
  6632. for index, joint in ipairs(joints) do
  6633. local v0, v1, v2, v3, v4 = rot0[index], rot1[index], rot2[index], rot3[index], rot4[index]
  6634. 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]
  6635. local px = GraphicalEffects.CubicInterpolate(p1.x, p2.x, p3.x, p4.x, progress)
  6636. local py = GraphicalEffects.CubicInterpolate(p1.y, p2.y, p3.y, p4.y, progress)
  6637. local pz = GraphicalEffects.CubicInterpolate(p1.z, p2.z, p3.z, p4.z, progress)
  6638. local rx = GraphicalEffects.CubicInterpolate(r1.x, r2.x, r3.x, r4.x, progress)
  6639. local ry = GraphicalEffects.CubicInterpolate(r1.y, r2.y, r3.y, r4.y, progress)
  6640. local rz = GraphicalEffects.CubicInterpolate(r1.z, r2.z, r3.z, r4.z, progress)
  6641. local cframe = CFrame.new(px, py, pz) * CFrame.Angles(rx, ry, rz)
  6642. joint.C0 = v0[1] * cframe
  6643. joint.C1 = v0[2] * cframe:inverse()
  6644. end
  6645. RunService.Stepped:wait()
  6646. end
  6647. end
  6648. end
  6649. end
  6650. -- Destruction spell
  6651. do
  6652. GraphicalEffects.destructionSpellSpeed = 5
  6653. GraphicalEffects.destructionSpellEffectSize = 2
  6654. GraphicalEffects.destructionSpellExplosionRate = 10
  6655. GraphicalEffects.destructionSpellFadeDuration = 120
  6656. local partProto = Instance.new("Part")
  6657. local partProtoDecal1 = Instance.new("Decal", partProto)
  6658. local partProtoDecal2 = Instance.new("Decal", partProto)
  6659. local partProtoGyro = Instance.new("BodyGyro", partProto)
  6660. local partProtoPosition = Instance.new("BodyPosition", partProto)
  6661. partProto.CanCollide = false
  6662. partProto.FormFactor = "Custom"
  6663. partProto.Transparency = 1
  6664. partProtoDecal1.Face = "Bottom"
  6665. partProtoDecal1.Texture = "rbxassetid://106508453"
  6666. partProtoDecal2.Face = "Top"
  6667. partProtoDecal2.Texture = "rbxassetid://106508453"
  6668. partProtoGyro.Name = "gyro"
  6669. partProtoGyro.P = 1e6
  6670. partProtoGyro.maxTorque = Vector3.new(1e9, 1e9, 1e9)
  6671. partProtoPosition.Name = "pos"
  6672. partProtoPosition.P = 1e4
  6673. partProtoPosition.maxForce = Vector3.new(1e9, 1e9, 1e9)
  6674. function GraphicalEffects.DestructionSpell(nodes)
  6675. local destroyTable = {}
  6676. local regionSizeX, regionSizeY, regionSizeZ
  6677. local function MagicalDestroyUnchecked(part)
  6678. local partSize = part.Size
  6679. if partSize.X < regionSizeX and partSize.Y < regionSizeY and partSize.Z < regionSizeZ then
  6680. destroyTable[part] = true
  6681. part.Material = "Plastic"
  6682. local beginTransparency = part.Transparency
  6683. local fadeDuration = GraphicalEffects.destructionSpellFadeDuration
  6684. for i = 1, fadeDuration do
  6685. RunService.Stepped:wait()
  6686. part.Transparency = beginTransparency + (1 - beginTransparency) * (i / fadeDuration)
  6687. end
  6688. pcall(Game.Destroy, part)
  6689. destroyTable[part] = nil
  6690. end
  6691. end
  6692. local function MagicalDestroy(part)
  6693. if not destroyTable[part] then
  6694. MagicalDestroyUnchecked(part)
  6695. end
  6696. end
  6697. local function MagicalNodeFinalize(part, gyro, pos, conn)
  6698. part.Anchored = true
  6699. pcall(gyro.Destroy, gyro)
  6700. pcall(pos.Destroy, pos)
  6701. conn:disconnect()
  6702. end
  6703. local model = Instance.new("Model")
  6704. model.Archivable = false
  6705. model.Name = "Nolix Wrath"
  6706. model.Parent = Workspace
  6707. local connections = {}
  6708. local parts = {}
  6709. local partsHit = {}
  6710. local cleanupList = {}
  6711. local explosionRate = GraphicalEffects.destructionSpellExplosionRate
  6712. local effectSize = GraphicalEffects.destructionSpellEffectSize
  6713. partProto.Size = Vector3.new(effectSize, 0.2, effectSize)
  6714. local speed = GraphicalEffects.destructionSpellSpeed
  6715. local rateTimer = 0
  6716. local partRotation = CFrame.Angles(0, 0.5 * math.pi, 0)
  6717. local minX, minY, minZ, maxX, maxY, maxZ = math.huge, math.huge, math.huge, -math.huge, -math.huge, -math.huge
  6718. for index = 4, #nodes do
  6719. local v0, v1, v2, v3 = nodes[index - 3], nodes[index - 2], nodes[index - 1], nodes[index]
  6720. local p1 = v1
  6721. local count = math.ceil((v2 - v1).magnitude / effectSize)
  6722. local linearStep = (v2 - v1) / count
  6723. for i = 1, count do
  6724. local alpha = i / count
  6725. local p2 = GraphicalEffects.CubicInterpolate(v0, v1, v2, v3, alpha)
  6726. local center = 0.5 * (p1 + p2)
  6727. local offset = p2 - p1
  6728. local partId = #parts + 1
  6729. local hitList = {}
  6730. partsHit[partId] = hitList
  6731. local part = partProto:Clone()
  6732. local gyro = part.gyro
  6733. local pos = part.pos
  6734. local cframe = CFrame.new(center, center + offset) * partRotation
  6735. part.CFrame = cframe
  6736. gyro.cframe = cframe
  6737. pos.position = center
  6738. local posX, posY, posZ = center.X, center.Y, center.Z
  6739. if posX < minX then minX = posX end
  6740. if posY < minY then minY = posY end
  6741. if posZ < minZ then minZ = posZ end
  6742. if posX > maxX then maxX = posX end
  6743. if posY > maxY then maxY = posY end
  6744. if posZ > maxZ then maxZ = posZ end
  6745. Instance.new("BlockMesh", part).Scale = Vector3.new(offset.magnitude, 0, effectSize)
  6746. parts[partId] = part
  6747. destroyTable[part] = true
  6748. local conn = part.Touched:connect(function(hit)
  6749. if not destroyTable[hit] then
  6750. hitList[hit] = true
  6751. end
  6752. end)
  6753. part.Parent = model
  6754. p1 = p2
  6755. TaskScheduler.Schedule(0.125, MagicalNodeFinalize, part, gyro, pos, conn)
  6756. rateTimer = rateTimer + 1
  6757. while rateTimer >= speed do
  6758. RunService.Stepped:wait()
  6759. rateTimer = rateTimer - speed
  6760. end
  6761. end
  6762. end
  6763. local center = Vector3.new(minX + maxX, minY + maxY, minZ + maxZ) * 0.5
  6764. regionSizeX, regionSizeY, regionSizeZ = maxX - minX, maxY - minY, maxZ - minZ
  6765. wait(0.5)
  6766. rateTimer = 0
  6767. for index, part in pairs(parts) do
  6768. if index % explosionRate == 1 then
  6769. local partSize = part.Size
  6770. if partSize.X < regionSizeX and partSize.Y < regionSizeY and partSize.Z < regionSizeZ then
  6771. local explosion = Instance.new("Explosion")
  6772. explosion.BlastPressure = 0
  6773. local position = part.Position
  6774. explosion.BlastRadius = (position - center).magnitude * 0.5
  6775. explosion.Position = (position + center) * 0.5
  6776. connections[#connections + 1] = explosion.Hit:connect(MagicalDestroy)
  6777. explosion.Parent = model
  6778. end
  6779. end
  6780. pcall(part.Destroy, part)
  6781. destroyTable[part] = nil
  6782. local hitList = partsHit[index]
  6783. for hit in pairs(hitList) do
  6784. local partSize = hit.Size
  6785. if partSize.X < regionSizeX and partSize.Y < regionSizeY and partSize.Z < regionSizeZ
  6786. and hit.Parent and not destroyTable[hit] then
  6787. TaskScheduler.Start(MagicalDestroyUnchecked, hit)
  6788. local explosion = Instance.new("Explosion")
  6789. explosion.BlastPressure = 0
  6790. explosion.BlastRadius = hit:GetMass() ^ (1 / 3) * 2
  6791. explosion.Position = hit.Position
  6792. connections[#connections + 1] = explosion.Hit:connect(MagicalDestroy)
  6793. explosion.Parent = model
  6794. end
  6795. end
  6796. rateTimer = rateTimer + 1
  6797. while rateTimer >= 4 * speed do
  6798. RunService.Stepped:wait()
  6799. rateTimer = rateTimer - 4 * speed
  6800. end
  6801. end
  6802. wait(0.25)
  6803. for _, connection in ipairs(connections) do
  6804. connection:disconnect()
  6805. end
  6806. end
  6807. end
  6808. -- MainLoop
  6809. function GraphicalEffects.MainLoop()
  6810. RunService.Stepped:wait()
  6811. for data in pairs(GraphicalEffects.magicCircleData) do
  6812. GraphicalEffects.AnimateMagicCircle(data)
  6813. end
  6814. for data in pairs(GraphicalEffects.laser_data) do
  6815. GraphicalEffects.AnimateLaserOfDeath(data)
  6816. end
  6817. for data in pairs(GraphicalEffects.missileData) do
  6818. GraphicalEffects.AnimateMissile(data)
  6819. end
  6820. end
  6821. TaskScheduler.Start(function()
  6822. while true do
  6823. GraphicalEffects.MainLoop()
  6824. end
  6825. end)
  6826. ]])
  6827. Module.Store("ServerControl", [=[
  6828. for _, child in ipairs(Game:GetChildren()) do
  6829. local success, className = pcall(function() return child.ClassName end)
  6830. if success and className == "NetworkServer" then
  6831. NetworkServer = child
  6832. break
  6833. end
  6834. end
  6835. ServerControl.banished_names = {}
  6836. for _, name in ipairs({
  6837. "12345678910jaijai",
  6838. "56awesome56",
  6839. "aleksa12432",
  6840. "blowup998",
  6841. "christmasboy",
  6842. "coolythe94",
  6843. "dalvo546",
  6844. "ENCRYPTEDis",
  6845. "fanoftheforgotten",
  6846. "goldenarrow97",
  6847. "Guest101632",
  6848. "hgbvcgdhgfds",
  6849. "IlIlXxxxxxXX12",
  6850. "InfiniteDeathKiller",
  6851. "JTHKILL99",
  6852. "liIlilILLIilIlil",
  6853. "LuaHat",
  6854. "LuaScriptPro",
  6855. "missKittyCatlove",
  6856. "MsDaisyroses",
  6857. "robloxmaster4491",
  6858. "rojdi3",
  6859. "s3sss3x",
  6860. "SBDESTROYER1",
  6861. "ScriptGuider",
  6862. "Scriptralize",
  6863. "ScriptTestingAccount",
  6864. "Scrupting",
  6865. "SomeMayCallMeATroll",
  6866. "starwill1",
  6867. "Starwill3",
  6868. "Toothyepic",
  6869. "trefor123"
  6870. }) do
  6871. ServerControl.banished_names[name:lower()] = true
  6872. end
  6873. for _, player in ipairs(Players:GetPlayers()) do
  6874. local playerName = tostring(player)
  6875. if ServerControl.banished_names[playerName:lower()] then
  6876. Logger.printf("Info", "Player %s has been kicked", playerName)
  6877. player:Kick()
  6878. end
  6879. end
  6880. ServerControl.LONG_STRING = string.rep("0123456789", 20001)
  6881. ServerControl.player_data = {}
  6882. function ServerControl.BanishName(name)
  6883. ServerControl.banished_names[name:lower()] = true
  6884. end
  6885. ServerControl.authorizedRemoteEvents = {}
  6886. ServerControl.MAX_MESSAGES = 2
  6887. ServerControl.message_list = {}
  6888. function ServerControl.BlockMessageSpam(object)
  6889. local message_list = ServerControl.message_list
  6890. local message_count = #message_list + 1
  6891. message_list[message_count] = object
  6892. if message_count > ServerControl.MAX_MESSAGES then
  6893. local new_message_count = 0
  6894. local new_message_list = {}
  6895. for message_index = 1, message_count do
  6896. local message_object = message_list[message_index]
  6897. local success, in_workspace = pcall(Game.IsDescendantOf, message_object, Workspace)
  6898. if success and in_workspace then
  6899. new_message_count = new_message_count + 1
  6900. new_message_list[new_message_count] = message_object
  6901. end
  6902. end
  6903. while new_message_count > ServerControl.MAX_MESSAGES do
  6904. local message_object = new_message_list[1]
  6905. Debris:AddItem(message_object, 0)
  6906. table.remove(new_message_list, 1)
  6907. new_message_count = new_message_count - 1
  6908. end
  6909. ServerControl.message_list = new_message_list
  6910. end
  6911. end
  6912. function ServerControl.FilterReplicatedStorage(child)
  6913. if child.ClassName == "RemoteEvent" and not ServerControl.authorizedRemoteEvents[child] then
  6914. Spawn(function()
  6915. child:Destroy()
  6916. Logger.printf("Info", "removed remote event %q from ReplicatedStorage", tostring(child))
  6917. end)
  6918. end
  6919. end
  6920. function ServerControl.GetPlayer(playerName)
  6921. if NetworkServer then
  6922. for _, replicator in ipairs(NetworkServer:GetChildren()) do
  6923. if replicator:IsA("NetworkReplicator") then
  6924. local player = replicator:GetPlayer()
  6925. if player and tostring(player) == playerName then
  6926. return player
  6927. end
  6928. end
  6929. end
  6930. end
  6931. end
  6932. function ServerControl.ListConnectedPlayers()
  6933. if NetworkServer then
  6934. for _, replicator in ipairs(NetworkServer:GetChildren()) do
  6935. if replicator:IsA("NetworkReplicator") then
  6936. local player = replicator:GetPlayer()
  6937. if player then
  6938. Logger.print("Output", tostring(player))
  6939. else
  6940. Logger.print("Output", "(joining)")
  6941. end
  6942. end
  6943. end
  6944. end
  6945. end
  6946. ServerControl.previous_player_list = {}
  6947. function ServerControl.MainLoop()
  6948. wait(1)
  6949. for _, player in ipairs(Players:GetChildren()) do
  6950. ypcall(function()
  6951. if player:IsA("Player") then
  6952. TaskScheduler.Schedule(ServerControl.ConnectPlayer, player)
  6953. end
  6954. end)
  6955. end
  6956. local buffer = {"AdvancedGUI.networkFrame:ClearItems()"}
  6957. local player_list = {}
  6958. local different = false
  6959. local replicator_count = 0
  6960. if NetworkServer then
  6961. for index, replicator in ipairs(NetworkServer:GetChildren()) do
  6962. if replicator:IsA("NetworkReplicator") then
  6963. local player = replicator:GetPlayer()
  6964. local item_text
  6965. if player then
  6966. local system_time, idle_time, user_name, is_nil
  6967. user_name = tostring(player)
  6968. local player_data = ServerControl.player_data[user_name]
  6969. if player_data then
  6970. system_time = player_data[1]
  6971. local idle_time_raw = player_data[2]
  6972. local seconds = idle_time_raw % 60
  6973. local minutes = (idle_time_raw - seconds) / 60
  6974. idle_time = string.format("%i:%04.1f", minutes, seconds)
  6975. else
  6976. system_time = "??:??:??"
  6977. idle_time = "?:??.?"
  6978. end
  6979. is_nil = not player.Parent
  6980. item_text = string.format("%s %s %s %s", system_time, idle_time, user_name, tostring(is_nil))
  6981. buffer[#buffer + 1] = string.format("AdvancedGUI.networkFrame:AddItem(%q, %q, %q, %s)", system_time, idle_time,
  6982.  
  6983. user_name, tostring(is_nil))
  6984. else
  6985. item_text = "(joining the game)"
  6986. buffer[#buffer + 1] = "GuiTextList.AddItem(AdvancedGUI.networkFrame, \"(joining the game)\")"
  6987. end
  6988. different = different or ServerControl.previous_player_list[index] ~= item_text
  6989. replicator_count = replicator_count + 1
  6990. player_list[index] = item_text
  6991. end
  6992. end
  6993. else
  6994. buffer[#buffer + 1] = string.format("AdvancedGUI.networkFrame:AddItem(\"<OFFLINE MODE>\")")
  6995. different = different or ServerControl.previous_player_list[1] ~= "<OFFLINE MODE>"
  6996. replicator_count = 1
  6997. player_list[1] = "<OFFLINE MODE>"
  6998. end
  6999. if different or #ServerControl.previous_player_list ~= replicator_count then
  7000. Network.TransmitController(table.concat(buffer, "\n"))
  7001. ServerControl.previous_player_list = player_list
  7002. end
  7003. end
  7004. ServerControl.connected_players = {}
  7005. ServerControl.connection_signals = {}
  7006. ServerControl.next_script_id = Network.script_id + 1
  7007. ServerControl.module_signal_packet_name = "MODULE_READY/" .. _SessionID .. "/" .. Network.server_id
  7008. function ServerControl.ConnectPlayer(player, forced)
  7009. if forced or not ServerControl.connected_players[player] then
  7010. ServerControl.connected_players[player] = 1
  7011. local valid, is_player = pcall(Game.IsA, player, "Player")
  7012. is_player = is_player == true or not valid
  7013. local is_controller = is_player and player.userId == ControllerInfo.user_id
  7014. local new_script_id
  7015. if is_controller then
  7016. new_script_id = Network.controller_id
  7017. else
  7018. new_script_id = ServerControl.next_script_id
  7019. ServerControl.next_script_id = new_script_id + 1
  7020. end
  7021. local network_receiver_script = SBTools.NewLocalScript(_SessionID .. "/" .. new_script_id, NetworkReceiver.source)
  7022. local marker_label = "ACKNOWLEDGE/" .. _SessionID .. "/" .. new_script_id
  7023. TaskScheduler.Start(function()
  7024. local connection_established = false
  7025. local listener
  7026. listener = ReplicatedStorage.ChildAdded:connect(function(child)
  7027. if child.Name == marker_label then
  7028. listener:disconnect()
  7029. local player_name = child.Value
  7030. Debris:AddItem(child, 0)
  7031. connection_established = true
  7032. Network.Register(player_name, new_script_id)
  7033. if not is_controller then
  7034. Network.TransmitController(string.format("Network.Register(%q, %s)", player_name, tostring(new_script_id)))
  7035. end
  7036. local signal = RbxUtility.CreateSignal()
  7037. ServerControl.connection_signals[new_script_id] = signal
  7038. Network.Transmit(new_script_id, string.format([[
  7039. local Module = {}
  7040. Module.name = "Module"
  7041. Module.source = %q
  7042. loadstring(Module.source)(Module)
  7043. setmetatable(Module, Module.metatable)
  7044. Module.Register(Module)
  7045. local packet = Instance.new("IntValue")
  7046. packet.Name = %q
  7047. packet.Value = %s
  7048. packet.Parent = Game:GetService("ReplicatedStorage")
  7049. ]], Module.source, ServerControl.module_signal_packet_name, tostring(new_script_id)))
  7050. signal:wait()
  7051. if ServerControl.connected_players[player] == 1 then
  7052. ServerControl.connected_players[player] = 2
  7053. ServerControl.connection_signals[new_script_id] = nil
  7054. Network.Transmit(new_script_id, "")
  7055. Network.TransmitModule(new_script_id, LuaEnum)
  7056. Network.TransmitModule(new_script_id, Logger)
  7057. Network.TransmitModule(new_script_id, Utility)
  7058. Network.TransmitModule(new_script_id, TaskScheduler)
  7059. Network.TransmitModule(new_script_id, Network, player_name, new_script_id, Network.controller_id)
  7060. if is_controller then
  7061. Network.TransmitModule(new_script_id, UserInterface, true)
  7062. Network.TransmitModule(new_script_id, PyramidCharacter)
  7063. Network.TransmitModule(new_script_id, CharacterAppearance)
  7064. Network.TransmitModule(new_script_id, PlayerControl)
  7065. Network.TransmitModule(new_script_id, ChatColor)
  7066. Network.TransmitModule(new_script_id, RBXInstance)
  7067. Network.TransmitModule(new_script_id, AdvancedGUI)
  7068. Network.TransmitModule(new_script_id, ControllerCommands)
  7069. local local_script_forward, server_script_forward
  7070. if SBTools.local_script and SBTools.server_script then
  7071. local_script_forward = SBTools.local_script:Clone()
  7072. server_script_forward = SBTools.server_script:Clone()
  7073. local_script_forward.Parent = ReplicatedStorage
  7074. server_script_forward.Parent = ReplicatedStorage
  7075. end
  7076. Network.TransmitModule(new_script_id, SBTools, local_script_forward, server_script_forward)
  7077. Network.StoreModule(new_script_id, NetworkReceiver)
  7078. Network.StoreModule(new_script_id, ChatBubble)
  7079. Network.StoreModule(new_script_id, Fragmentation)
  7080. Network.StoreModule(new_script_id, GraphicalEffects)
  7081. Network.StoreModule(new_script_id, ServerControl)
  7082. else
  7083. Network.TransmitModule(new_script_id, UserInterface)
  7084. end
  7085. Network.TransmitModule(new_script_id, Notification)
  7086. end
  7087. end
  7088. end)
  7089. repeat
  7090. if is_player then
  7091. local success, errorMessage = ypcall(function()
  7092. for _, child in ipairs(Workspace:GetChildren()) do
  7093. if Players:GetPlayerFromCharacter(child) == player then
  7094. local pscript = network_receiver_script:Clone()
  7095. pscript.Parent = child
  7096. wait()
  7097. pscript.Disabled = false
  7098. local changed_connection = pscript.Changed:connect(function(property)
  7099. if property == "Disabled" and pscript.Disabled then
  7100. wait()
  7101. pscript.Disabled = false
  7102. end
  7103. end)
  7104. wait(15)
  7105. changed_connection:disconnect()
  7106. break
  7107. end
  7108. end
  7109. end)
  7110. if not success then
  7111. Logger.printf("Severe", "Error in ServerControl.ConnectPlayer: %s", errorMessage)
  7112. end
  7113. success, errorMessage = ypcall(function()
  7114. if not (connection_established or not player.Parent) then
  7115. local pscript = network_receiver_script:Clone()
  7116. pscript.Parent = player:WaitForChild("Backpack")
  7117. wait()
  7118. pscript.Disabled = false
  7119. local changed_connection = pscript.Changed:connect(function(property)
  7120. if property == "Disabled" and pscript.Disabled then
  7121. wait()
  7122. pscript.Disabled = false
  7123. end
  7124. end)
  7125. wait(15)
  7126. changed_connection:disconnect()
  7127. end
  7128. end)
  7129. if not success then
  7130. Logger.printf("Severe", "Error in ServerControl.ConnectPlayer: %s", errorMessage)
  7131. end
  7132. else
  7133. local success, errorMessage = ypcall(function()
  7134. local pscript = network_receiver_script:Clone()
  7135. pscript.Parent = player
  7136. wait()
  7137. pscript.Disabled = false
  7138. local changed_connection = pscript.Changed:connect(function(property)
  7139. if property == "Disabled" and pscript.Disabled then
  7140. wait()
  7141. pscript.Disabled = false
  7142. end
  7143. end)
  7144. wait(15)
  7145. changed_connection:disconnect()
  7146. end)
  7147. if not success then
  7148. Logger.printf("Severe", "Error in ServerControl.ConnectPlayer: %s", errorMessage)
  7149. end
  7150. end
  7151. wait()
  7152. until connection_established or not pcall(function() assert(player.Parent) end)
  7153. end)
  7154. end
  7155. end
  7156. function ServerControl.HandleEstablishmentPacket(packet)
  7157. if tostring(packet) == ServerControl.module_signal_packet_name and packet.ClassName == "IntValue" then
  7158. local success, message = ypcall(function() ServerControl.connection_signals[packet.Value]:fire() end)
  7159. if not success then
  7160. Logger.printf("Severe", "Error in ServerControl.HandleEstablishmentPacket: %s", message)
  7161. end
  7162. Debris:AddItem(packet, 0)
  7163. end
  7164. end
  7165. function ServerControl.OnConnectionRemoving(replicator)
  7166. local player = replicator:GetPlayer()
  7167. if player then
  7168. local player_name = tostring(player)
  7169. Network.script_ids[player_name] = nil
  7170. ServerControl.player_data[player_name] = nil
  7171. end
  7172. end
  7173. function ServerControl.OnWorkspaceDescendantAdded(object)
  7174. local class_name = object.ClassName
  7175. if class_name == "Message" or class_name == "Hint" then
  7176. local success, message = ypcall(ServerControl.BlockMessageSpam, object)
  7177. if not success then
  7178. Logger.printf("Severe", "Error in ServerControl.BlockMessageSpam: %s", message)
  7179. end
  7180. end
  7181. end
  7182. function ServerControl.RemoteDisconnect(target, banish)
  7183. local targetCaseInsensitive = Utility.CaseInsensitivePattern(target)
  7184. local remoteEvent = Instance.new("RemoteEvent")
  7185. ServerControl.authorizedRemoteEvents[remoteEvent] = true
  7186. remoteEvent.Parent = ReplicatedStorage
  7187. for _, replicator in ipairs(NetworkServer:GetChildren()) do
  7188. local className = Utility.SafeGetProperty(replicator, "ClassName")
  7189. if className == "ServerReplicator" then
  7190. local player = replicator:GetPlayer()
  7191. if player then
  7192. local playerName = tostring(player)
  7193. if string.find(playerName, targetCaseInsensitive) then
  7194. Logger.printf("Info", "Disconnecting%s player %s using RemoteEvent", banish and " and banishing" or "",
  7195.  
  7196. Utility.ToString(player))
  7197. if banish then
  7198. ServerControl.BanishName(playerName)
  7199. end
  7200. remoteEvent:FireClient(player, ServerControl.LONG_STRING)
  7201. end
  7202. end
  7203. end
  7204. end
  7205. ServerControl.authorizedRemoteEvents[remoteEvent] = false
  7206. Debris:AddItem(remoteEvent, 1)
  7207. end
  7208. function ServerControl.SendConnections()
  7209. local buffer = {}
  7210. for name, id in pairs(Network.script_ids) do
  7211. if id == Network.controller_id then
  7212. buffer[#buffer + 1] = string.format("Network.script_ids[\"\"] = %s;", tostring(id))
  7213. else
  7214. buffer[#buffer + 1] = string.format("Network.script_ids[%q] = %s;", name, tostring(id))
  7215. end
  7216. end
  7217. Network.TransmitController(table.concat(buffer))
  7218. end
  7219. function ServerControl.PlayerAdded(player)
  7220. if not (ServerControl.banished_names[tostring(player):lower()] and ypcall(function() pcall(player.Kick, player) wait() pcall(Game.Destroy, player)
  7221.  
  7222. Logger.printf("Info", "Prevented player %s from entering", tostring(player)) end)) then
  7223. local success, message = ypcall(ServerControl.ConnectPlayer, player)
  7224. if not success then
  7225. Logger.printf("Severe", "Error in ServerControl.ConnectPlayer: %s", message)
  7226. end
  7227. end
  7228. end
  7229. Players.PlayerAdded:connect(function(...)
  7230. ServerControl.PlayerAdded(...)
  7231. end)
  7232. for _, player in ipairs(Players:GetChildren()) do
  7233. pcall(function()
  7234. if player:IsA("Player") then
  7235. ServerControl.ConnectPlayer(player)
  7236. end
  7237. end)
  7238. end
  7239. function ServerControl.SBScriptInject(child)
  7240. if child.ClassName == "Script" then
  7241. local value = child:WaitForChild(SBTools.source_name)
  7242. if not value or value.ClassName ~= "StringValue" then
  7243. return
  7244. end
  7245. value.Value = [[do local
  7246.  
  7247. a,b,c,d,_a,aa,ba,ca,da,_b,ab,bb,cb,db,_c,ac,bc,cc,dc,_d,ad=true,coroutine.yield,error,getfenv,pairs,rawset,setfenv,setmetatable,tonumber,type,script,Game:Ge
  7248.  
  7249. tService("ReplicatedStorage")rbx_ENV=d(1)patched=ca({},{__index=rbx_ENV})db={__index=patched,__metatable="The metatable is locked"}_c=ca({},db)function ac
  7250.  
  7251. (bd)c("The script has terminated",bd+1)end;function bc(bd)return function(...)if not a then ac(2)end;return bd(...)end end function cc(bd,cd)local
  7252.  
  7253. dd,__a=rbx_ENV[bd],{}for a_a,b_a in ipairs(cd)do __a[b_a]=bc(dd[b_a])end patched[bd]=ca({},{__metatable="The metatable is locked",__index=ca(__a,
  7254.  
  7255. {__index=dd}),__newindex=dd})end for bd,cd in ipairs
  7256.  
  7257. {"assert","delay","Delay","getmetatable","ipairs","next","pairs","pcall","print","rawequal","rawget","rawset","select","setmetatable","Spawn","tick","time",
  7258.  
  7259. "tonumber","tostring","type","unpack","wait","Wait","ypcall"}do patched[cd]=bc(rbx_ENV[cd])end for bd,cd in pairs{BrickColor=
  7260.  
  7261. {"new","palette","random"},Color3={"new"},CFrame={"Angles","fromAxisAngle","fromEulerAnglesXYZ","new"},coroutine=
  7262.  
  7263. {"create","resume","wrap","yield"},Instance={"Lock","new","Unlock"},Ray={"new"},Region3={"new"},UDim2={"new"},Vector2={"new"},Vector3=
  7264.  
  7265. {"FromAxis","FromNormalId","new"}}do cc(bd,cd)end function patched.getfenv(bd)if bd==nil then bd=1 end;local cd=_b(bd)local dd=da(bd)local __a if dd then if
  7266.  
  7267. dd>0.5 then dd=dd+1 elseif dd<-0.5 then c("bad argument #1 to 'getfenv' (level must be non-negative)",2)else dd=0 end;__a=d(dd)elseif cd=="function"then
  7268.  
  7269. __a=d(bd)else c("bad argument #1 to 'getfenv' (number expected, got "..cd..")",2)end;if __a.pairs==_a then __a=_c end;return __a end;ba(0,_c)ba
  7270.  
  7271. (1,_c)function dc(bd)if bd.Name=="__TERMINATE_SB_SCRIPTS__"and bd.ClassName=="NumberValue"and bd.Value==]].._SessionID..[[ then _d:disconnect
  7272.  
  7273. ()a=false;db.__index=nil for cd in _a(_c)do aa(_c,cd,nil)end;db.__newindex={}ba(0,{})end end;_d=bb.ChildAdded:connect
  7274.  
  7275. (dc)ad=ab.Parent.DescendantRemoving:connect(function(bd)if bd==ab then ad:disconnect()ab.Disabled=true;b()ab.Disabled=false _d:disconnect
  7276.  
  7277. ()_d=bb.ChildAdded:connect(dc)end end)end;]] .. value.Value
  7278. end
  7279. end
  7280. ReplicatedStorage.ChildAdded:connect(function(child)
  7281. ServerControl.HandleEstablishmentPacket(child)
  7282. end)
  7283. if NetworkServer then
  7284. NetworkServer.DescendantRemoving:connect(function(...)
  7285. local success, message = pcall(ServerControl.OnConnectionRemoving, ...)
  7286. if not success then
  7287. Logger.printf("Severe", "Error in ServerControl.OnConnectionRemoving: %s", message)
  7288. end
  7289. end)
  7290. end
  7291. ReplicatedStorage.ChildAdded:connect(function(...)
  7292. local success, message = pcall(ServerControl.FilterReplicatedStorage, ...)
  7293. if not success then
  7294. Logger.printf("Severe", "Error in ServerControl.FilterReplicatedStorage: %s", message)
  7295. end
  7296. end)
  7297. for _, child in ipairs(ReplicatedStorage:GetChildren()) do
  7298. local success, message = pcall(ServerControl.FilterReplicatedStorage, child)
  7299. if not success then
  7300. Logger.printf("Severe", "Error in ServerControl.FilterReplicatedStorage: %s", message)
  7301. end
  7302. end
  7303. if SBTools.server_script then
  7304. Logger.print("Info", "Enabling server script injection in ServerControl")
  7305. Workspace.ChildAdded:connect(function(child)
  7306. success, message = ypcall(ServerControl.SBScriptInject, child)
  7307. if not success then
  7308. Logger.printf("Severe", "Error in ServerControl.SBScriptInject", message)
  7309. end
  7310. end)
  7311. end
  7312. Logger.print("Info", "Enabling message spam blocker in ServerControl")
  7313. Workspace.DescendantAdded:connect(function(object)
  7314. ServerControl.OnWorkspaceDescendantAdded(object)
  7315. end)
  7316. TaskScheduler.Start(function()
  7317. while true do
  7318. ServerControl.MainLoop()
  7319. end
  7320. end)
  7321. ]=])
  7322. Module.Store("CustomSB", [[
  7323. local function PlayerAdded(player)
  7324. player.Chatted:connect(function(message)
  7325. local source
  7326. source = string.match(message, "^script/(.*)")
  7327. if source then
  7328. local script = SBTools.NewScript("QuickScript", source, Workspace)
  7329. script.Disabled = false
  7330. else
  7331. source = string.match(message, "^local/(.*)")
  7332. if source then
  7333. local script = SBTools.NewLocalScript("QuickScript", source, player:FindFirstChild("Backpack"))
  7334. script.Disabled = false
  7335. end
  7336. end
  7337. end)
  7338. end
  7339. for _, player in ipairs(Players:GetChildren()) do
  7340. pcall(PlayerAdded, player)
  7341. end
  7342. Players.PlayerAdded:connect(function(player)
  7343. pcall(PlayerAdded, player)
  7344. end)
  7345. ]])
  7346. Module.Create("ControllerCommands", [=[
  7347. ControllerCommands.altKey = "["
  7348. ControllerCommands.BALEFIRE_SPEED = 40
  7349. function ControllerCommands.BalefireAtMouse()
  7350. local head = PlayerControl.GetHead()
  7351. if head then
  7352. local target = Mouse.Hit.p
  7353. local origin = head.Position
  7354. local direction = (target - origin).unit
  7355. local explosionCount = 0
  7356. local animation_frame = 0
  7357. local magic_circle_position = origin + direction * 4
  7358. local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction)
  7359. local magic_circle_part = Instance.new("Part")
  7360. local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part)
  7361. local magic_circle_light = Instance.new("PointLight", magic_circle_part)
  7362. local magic_circle_decal_back = Instance.new("Decal", magic_circle_part)
  7363. local magic_circle_decal_front = Instance.new("Decal", magic_circle_part)
  7364. magic_circle_part.Anchored = true
  7365. magic_circle_part.Archivable = false
  7366. magic_circle_part.BottomSurface = "Smooth"
  7367. magic_circle_part.CanCollide = false
  7368. magic_circle_part.CFrame = magic_circle_cframe
  7369. magic_circle_part.FormFactor = "Custom"
  7370. magic_circle_part.Locked = true
  7371. magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2)
  7372. magic_circle_part.TopSurface = "Smooth"
  7373. magic_circle_part.Transparency = 1
  7374. magic_circle_mesh.Scale = Vector3.new(60, 60, 0)
  7375. magic_circle_light.Color = Color3.new(1, 0.5, 1)
  7376. magic_circle_light.Range = 16
  7377. magic_circle_light.Shadows = true
  7378. magic_circle_decal_back.Face = "Back"
  7379. magic_circle_decal_back.Texture = "rbxassetid://122610943"
  7380. magic_circle_decal_front.Face = "Front"
  7381. magic_circle_decal_front.Texture = "rbxassetid://122610943"
  7382. local function NextExplosion()
  7383. explosionCount = explosionCount + 1
  7384. Instance.new("Explosion", Workspace).Position = origin + direction * (explosionCount * 8 + 4)
  7385. end
  7386. local function AnimateMagicCircle()
  7387. animation_frame = animation_frame + 1
  7388. local transparency = (animation_frame / 40) ^ 3
  7389. if animation_frame == 40 then
  7390. pcall(Game.Destroy, magic_circle_part)
  7391. else
  7392. if magic_circle_part.Parent ~= Workspace then
  7393. pcall(Utility.SetProperty, magic_circle_part, "Parent", Workspace)
  7394. end
  7395. head = PlayerControl.GetHead()
  7396. if head then
  7397. magic_circle_position = head.Position + direction * 4
  7398. end
  7399. magic_circle_part.CFrame = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0,
  7400.  
  7401. math.tau * animation_frame / 40 * 1.5)
  7402. magic_circle_light.Brightness = 1 - transparency
  7403. magic_circle_decal_back.Transparency = transparency
  7404. magic_circle_decal_front.Transparency = transparency
  7405. end
  7406. end
  7407. magic_circle_part.Parent = Workspace
  7408. for i = 1, 40 do
  7409. Delay((i - 1) / ControllerCommands.BALEFIRE_SPEED, NextExplosion)
  7410. Delay((i - 1) / 30, AnimateMagicCircle)
  7411. end
  7412. for i = 1, 20 do
  7413. Delay((i - 1) / ControllerCommands.BALEFIRE_SPEED, NextExplosion)
  7414. end
  7415. end
  7416. end
  7417. function ControllerCommands.ControlRandomDummy()
  7418. local dummies = {}
  7419. local numDummies = 0
  7420. for _, character in ipairs(Workspace:GetChildren()) do
  7421. local name = tostring(character)
  7422. if name == "???" or name == "Dummy" then
  7423. local head, humanoid
  7424. for _, child in ipairs(character:GetChildren()) do
  7425. local className = child.ClassName
  7426. if className == "Part" and tostring(child) == "Head" then
  7427. head = child
  7428. if humanoid then
  7429. break
  7430. end
  7431. elseif className == "Humanoid" then
  7432. if child.Health > 0 then
  7433. humanoid = child
  7434. if head then
  7435. break
  7436. end
  7437. else
  7438. break
  7439. end
  7440. end
  7441. end
  7442. if head and humanoid then
  7443. numDummies = numDummies + 1
  7444. dummies[numDummies] = {character, head, humanoid}
  7445. end
  7446. end
  7447. end
  7448. if numDummies > 0 then
  7449. local dummy = dummies[math.random(numDummies)]
  7450. Player.Character = dummy[1]
  7451. Network.TransmitServer("chatAdornee = ...", dummy[2])
  7452. Camera.CameraSubject = dummy[3]
  7453. Camera.CameraType = "Track"
  7454. end
  7455. end
  7456. function ControllerCommands.Decalify(textures, exclusion)
  7457. local objects = Workspace:GetChildren()
  7458. for _, object in ipairs(objects) do
  7459. if not exclusion[object] then
  7460. for _, child in ipairs(object:GetChildren()) do
  7461. objects[#objects + 1] = child
  7462. end
  7463. if object:IsA("BasePart") then
  7464. local texture = textures[math.random(#textures)]
  7465. local face_left = Instance.new("Decal", object)
  7466. face_left.Face = Enum.NormalId.Left
  7467. face_left.Texture = texture
  7468. local face_right = Instance.new("Decal", object)
  7469. face_right.Face = Enum.NormalId.Right
  7470. face_right.Texture = texture
  7471. local face_bottom = Instance.new("Decal", object)
  7472. face_bottom.Face = Enum.NormalId.Bottom
  7473. face_bottom.Texture = texture
  7474. local face_top = Instance.new("Decal", object)
  7475. face_top.Face = Enum.NormalId.Top
  7476. face_top.Texture = texture
  7477. local face_front = Instance.new("Decal", object)
  7478. face_front.Face = Enum.NormalId.Front
  7479. face_front.Texture = texture
  7480. local face_back = Instance.new("Decal", object)
  7481. face_back.Face = Enum.NormalId.Back
  7482. face_back.Texture = texture
  7483. end
  7484. end
  7485. end
  7486. end
  7487. function ControllerCommands.EnableOfflineMode()
  7488. Network.script_ids["[SERVER]"] = Network.controller_id
  7489. Network.server_id = Network.controller_id
  7490. Module.Initialize(ChatBubble)
  7491. Module.Initialize(GraphicalEffects)
  7492. end
  7493. function ControllerCommands.ExplodeAtMouse()
  7494. local explosion = Instance.new("Explosion")
  7495. explosion.Position = Mouse.Hit.p
  7496. explosion.Parent = Workspace
  7497. end
  7498. function ControllerCommands.LaserAtMouse()
  7499. Network.TransmitServer("GraphicalEffects.ShootLaserOfDeath(...)", Mouse.Hit.p)
  7500. end
  7501. function ControllerCommands.BigLaser(target)
  7502. Network.TransmitServer("GraphicalEffects.ShootLaserOfDeath(..., {brickcolor = BrickColor.new(\"New Yeller\"), duration = 80, fragmentation_size = 6,
  7503.  
  7504. laser_scale = 30, light_color = Color3.new(1, 0.5, 0), magic_circle_image = \"rbxassetid://126561317\", magic_circle_scale = 1.5, sound_volume = 1,
  7505.  
  7506. special_effects = BrickColor.new(\"Deep orange\"), stay = 2})", target)
  7507. end
  7508. function ControllerCommands.BigLaserAtMouse()
  7509. ControllerCommands.BigLaser(Mouse.Hit.p)
  7510. end
  7511. function ControllerCommands.ShootMissile(targetPart, pointOnPart, direction)
  7512. Network.TransmitServer("GraphicalEffects.ShootMissile(...)", targetPart, pointOnPart, direction)
  7513. end
  7514. function ControllerCommands.ShootMissileAtMouse(amount, spread, delayTime)
  7515. local exclusionList = {}
  7516. local playerHead = PlayerControl.GetHead()
  7517. local playerTorso = PlayerControl.GetTorso()
  7518. if playerHead and playerTorso then
  7519. exclusionList[playerTorso] = true
  7520. local humanoid, torso = Utility.FindHumanoidClosestToRay(Mouse.UnitRay, exclusionList)
  7521. local targetPart, pointOnPart
  7522. if humanoid and torso then
  7523. targetPart, pointOnPart = torso, Vector3.new()
  7524. else
  7525. local target = Mouse.Target
  7526. if target then
  7527. targetPart, pointOnPart = target, target.CFrame:pointToObjectSpace(Mouse.Hit.p)
  7528. else
  7529. return
  7530. end
  7531. end
  7532. if targetPart then
  7533. local direction = (Mouse.Hit.p - playerHead.Position).unit
  7534. delayTime = delayTime or 0
  7535. for index = 1, amount do
  7536. local angles = math.tau * (index - 0.5) * spread / amount * Vector3.new(math.random() - 0.5, math.random() - 0.5,
  7537.  
  7538. math.random() - 0.5).unit
  7539. TaskScheduler.Schedule(delayTime * (index - 1), ControllerCommands.ShootMissile, targetPart, pointOnPart, CFrame.Angles
  7540.  
  7541. (angles.X, angles.Y, angles.Z) * direction)
  7542. end
  7543. end
  7544. end
  7545. end
  7546. function ControllerCommands.ShootMissileAroundMouse(amount, offset, delayTime)
  7547. local exclusionList = {}
  7548. local playerHead = PlayerControl.GetHead()
  7549. local playerTorso = PlayerControl.GetTorso()
  7550. if playerHead and playerTorso then
  7551. exclusionList[playerTorso] = true
  7552. local humanoid, torso = Utility.FindHumanoidClosestToRay(Mouse.UnitRay, exclusionList)
  7553. local targetPart, pointOnPart
  7554. if humanoid and torso then
  7555. targetPart, pointOnPart = torso, Vector3.new()
  7556. else
  7557. local target = Mouse.Target
  7558. if target then
  7559. targetPart, pointOnPart = target, target.CFrame:pointToObjectSpace(Mouse.Hit.p)
  7560. else
  7561. return
  7562. end
  7563. end
  7564. if targetPart then
  7565. delayTime = delayTime or 0
  7566. local index = 1
  7567. local targetPoint = targetPart.CFrame * pointOnPart
  7568. local rotation_offset_angles = math.tau * Vector3.new(math.random() - 0.5, math.random() - 0.5, 0).unit
  7569. local rotation_offset = CFrame.Angles(rotation_offset_angles.x, rotation_offset_angles.y, 0)
  7570. local angle_x = 0
  7571. local angle_x_step = math.tau / math.phi
  7572. for i = 1, 8 * amount do
  7573. angle_x = angle_x + angle_x_step
  7574. local direction = rotation_offset * (CFrame.Angles(0, math.tau * index / amount, 0) * CFrame.Angles(angle_x, 0,
  7575.  
  7576. 0).lookVector)
  7577. local blocked = Workspace:FindPartOnRay(Ray.new(targetPoint, direction * offset), targetPart.Parent)
  7578. if not blocked then
  7579. TaskScheduler.Schedule(delayTime * (index - 1), Network.TransmitServer, "local p0, p1, p2, p3 = ...;
  7580.  
  7581. GraphicalEffects.ShootMissile(p0, p1, p2, function() return p0 end, p3, true)", targetPart, pointOnPart, direction, offset)
  7582. index = index + 1
  7583. if index > amount then
  7584. break
  7585. end
  7586. end
  7587. end
  7588. end
  7589. end
  7590. end
  7591. local _ = string.char
  7592. function ControllerCommands.HugeExplosionOfDoom(position)
  7593. local connections = {}
  7594. local parts = {}
  7595. local cframe = CFrame.new(position)
  7596. local function ExplosionHit(part)
  7597. if part:GetMass() < 10000 and part.Parent ~= Camera then
  7598. parts[part] = true
  7599. part.Anchored = true
  7600. part:BreakJoints()
  7601. part.BrickColor = BrickColor.new("Instituational white")
  7602. end
  7603. end
  7604. for i = 1, 4 do
  7605. local quantity = 0.5 * i * (1 + i)
  7606. local fraction = math.tau / quantity
  7607. for x = 1, quantity do
  7608. for y = 1, quantity do
  7609. local explosion = Instance.new("Explosion")
  7610. connections[#connections + 1] = explosion.Hit:connect(ExplosionHit)
  7611. explosion.BlastRadius = 5
  7612. explosion.Position = cframe * (CFrame.Angles(fraction * x, fraction * y, 0) * Vector3.new((i - 1) * 6, 0, 0))
  7613. explosion.Parent = Workspace
  7614. end
  7615. end
  7616. wait(0.075)
  7617. end
  7618. for part in pairs(parts) do
  7619. for _, child in ipairs(part:GetChildren()) do
  7620. if child:IsA("BodyMover") then
  7621. child:Destroy()
  7622. end
  7623. end
  7624. local mass = part:GetMass()
  7625. local velocity = CFrame.Angles(math.tau * math.random(), math.tau * math.random(), 0) * Vector3.new(25, 0, 0)
  7626. local bodythrust = Instance.new("BodyThrust")
  7627. bodythrust.force = mass * -velocity
  7628. bodythrust.Parent = part
  7629. local bodyforce = Instance.new("BodyForce")
  7630. bodyforce.force = mass * Vector3.new(0, 196.2, 0)
  7631. bodyforce.Parent = part
  7632. part.Anchored = false
  7633. part.Reflectance = 1
  7634. part.RotVelocity = math.tau * Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5)
  7635. part.Transparency = 0.5
  7636. part.Velocity = (part.CFrame - part.Position) * velocity
  7637. end
  7638. for _, connection in ipairs(connections) do
  7639. connection:disconnect()
  7640. end
  7641. for i = 0, 99 do
  7642. Delay(i / 10, function()
  7643. for part in pairs(parts) do
  7644. local new_transparency = 0.5 * (1 + i / 50)
  7645. part.Reflectance = 0.98 * part.Reflectance
  7646. if new_transparency > part.Transparency then
  7647. part.Transparency = new_transparency
  7648. end
  7649. end
  7650. end)
  7651. end
  7652. Delay(10, function()
  7653. for part in pairs(parts) do
  7654. pcall(part.Destroy, part)
  7655. end
  7656. end)
  7657. end
  7658. function ControllerCommands.HugeExplosionOfDoomAtMouse()
  7659. ControllerCommands.HugeExplosionOfDoom(Mouse.Hit.p)
  7660. end
  7661. function ControllerCommands.PrintClosestCamera(position, timeout)
  7662. if ControllerCommands.cameraPoints then
  7663. Logger.print("Warning", "ControllerCommands.PrintClosestCamera() can only be used once at a time!")
  7664. return
  7665. end
  7666. local cameraPoints = {}
  7667. ControllerCommands.cameraPoints = cameraPoints
  7668. Network.Transmit("^[^<]", [[Network.TransmitController(string.format("local c = ControllerCommands.cameraPoints if c then c[%q] =
  7669.  
  7670. Workspace.CurrentCamera.Focus.p end", tostring(Player)))]])
  7671. Wait(timeout)
  7672. ControllerCommands.cameraPoints = nil
  7673. local minDistance, closestPlayerName = math.huge, nil
  7674. for playerName, cameraPoint in pairs(cameraPoints) do
  7675. local distance = (cameraPoint - position).magnitude
  7676. if distance < minDistance then
  7677. minDistance = distance
  7678. closestPlayerName = playerName
  7679. end
  7680. end
  7681. if closestPlayerName then
  7682. Logger.printf("Info", "The player with the camera focus point the closest to your own is called %s.", closestPlayerName)
  7683. else
  7684. Logger.print("Warning", "No camera point data was received.")
  7685. end
  7686. end
  7687. function ControllerCommands.SpaceHyperBeam(...)
  7688. Network.TransmitServer("GraphicalEffects.SpaceHyperBeam(...)", ...)
  7689. end
  7690. function ControllerCommands.SpaceHyperBeamAtMouse()
  7691. ControllerCommands.SpaceHyperBeam(Mouse.Hit.p)
  7692. end
  7693. function ControllerCommands.ConcentratedSpaceHyperBeamAtMouse()
  7694. Network.TransmitServer("local p = ...; for i = 1, 50 do GraphicalEffects.SpaceHyperBeam(p) end", Mouse.Hit.p)
  7695. end
  7696. ControllerCommands.MAX_SPACE_HYPER_BEAM_LENGTH = 20
  7697. ControllerCommands.SPACE_HYPER_BEAM_DELAY = 0.1
  7698. ControllerCommands.SPACE_HYPER_BEAM_SPACING = 20
  7699. ControllerCommands.SPACE_HYPER_BEAM_START_OFFSET = 20
  7700. function ControllerCommands.SpaceHyperBeamToMouse()
  7701. local head = PlayerControl.GetHead()
  7702. if head then
  7703. local points = {}
  7704. local target = Mouse.Hit.p
  7705. local start_offset = ControllerCommands.SPACE_HYPER_BEAM_START_OFFSET
  7706. local origin = head.CFrame * Vector3.new(0, -1.5, 0)
  7707. local distance = (target - origin) * Vector3.new(1, 0, 1)
  7708. local direction = distance.unit
  7709. local distance = distance.magnitude
  7710. local spacing = ControllerCommands.SPACE_HYPER_BEAM_SPACING
  7711. local max_distance = ControllerCommands.MAX_SPACE_HYPER_BEAM_LENGTH * spacing
  7712. if distance > max_distance then
  7713. distance = max_distance
  7714. else
  7715. distance = distance + (spacing - distance) % spacing
  7716. end
  7717. target = origin + direction * distance
  7718. for offset = 0, distance, spacing do
  7719. local part, hit_point = Workspace:FindPartOnRay(Ray.new(
  7720. origin + direction * (start_offset + offset) + Vector3.new(0, 500, 0),
  7721. Vector3.new(0, -1000, 0)
  7722. ))
  7723. points[#points + 1] = hit_point
  7724. end
  7725. Network.TransmitServer(string.format("for _, point in ipairs {...} do GraphicalEffects.SpaceHyperBeam(point) wait(%s) end", tostring
  7726.  
  7727. (ControllerCommands.SPACE_HYPER_BEAM_DELAY)), unpack(points))
  7728. end
  7729. end
  7730. function ControllerCommands.SpawnSapientRock(position)
  7731. Network.TransmitServer("GraphicalEffects.SpawnSapientRock(...)", position)
  7732. end
  7733. function ControllerCommands.SpawnSapientRockAtMouse()
  7734. ControllerCommands.SpawnSapientRock(Mouse.Hit.p)
  7735. end
  7736. function ControllerCommands.TeleportCharacterToMouse()
  7737. if PlayerControl.IsEnabled() then
  7738. local torso = PlayerControl.GetTorso()
  7739. if torso then
  7740. local pos = Mouse.Hit.p + Vector3.new(0, 5, 0)
  7741. torso.CFrame = CFrame.new(pos, pos + torso.CFrame.lookVector)
  7742. end
  7743. else
  7744. local new_focus_position = Mouse.Hit.p
  7745. local direction_vector = Camera.CoordinateFrame.lookVector
  7746. local new_focus = CFrame.new(new_focus_position, new_focus_position + direction_vector)
  7747. Camera.CoordinateFrame = new_focus * CFrame.new(0, 0, 25)
  7748. Camera.Focus = new_focus
  7749. end
  7750. end
  7751. function ControllerCommands.Reboot()
  7752. Network.TransmitServer([[
  7753. TaskScheduler.Start(function()
  7754. while true do
  7755. ChatBubble.MainLoop()
  7756. end
  7757. end)
  7758. TaskScheduler.Start(function()
  7759. while true do
  7760. GraphicalEffects.MainLoop()
  7761. end
  7762. end)
  7763. TaskScheduler.Start(function()
  7764. while true do
  7765. ServerControl.MainLoop()
  7766. end
  7767. end)
  7768. local theme = ChatBubble.GetTheme()
  7769. ChatBubble.SetTheme("Classic")
  7770. ChatBubble.Create("[REBOOT COMPLETE]")
  7771. wait(0.5)
  7772. ChatBubble.Create("[ALL SYSTEMS READY]")
  7773. ChatBubble.SetTheme(theme)
  7774. ]])
  7775. end
  7776. function ControllerCommands.ResetAdvancedGui()
  7777. GuiService:Destroy()
  7778. Module.Initialize(AdvancedGUI)
  7779. end
  7780. function ControllerCommands.FixLimbs(target)
  7781. local targetCaseInsensitive = Utility.CaseInsensitivePattern(target)
  7782. local character = PlayerControl.GetCharacter()
  7783. local user_torso = PlayerControl.GetTorso()
  7784. local objects = workspace:GetChildren()
  7785. for _, object in ipairs(objects) do
  7786. local humanoid
  7787. for _, child in ipairs(object:GetChildren()) do
  7788. objects[#objects + 1] = child
  7789. if child:IsA("Humanoid") then
  7790. humanoid = child
  7791. end
  7792. end
  7793. if humanoid and object.Name:lower():match(targetCaseInsensitive) then
  7794. local bc
  7795. for _, o in ipairs(object:GetChildren()) do
  7796. if o:IsA("BodyColors") then
  7797. bc = o
  7798. end
  7799. end
  7800. local fixing = false
  7801. local torso = object:FindFirstChild("Torso")
  7802. if torso and torso:IsA("Part") then
  7803. if not object:FindFirstChild("Left Arm") or not torso:FindFirstChild("Left Shoulder") then
  7804. fixing = true
  7805. local s = character["Left Arm"]:Clone()
  7806. local j = user_torso["Left Shoulder"]:Clone()
  7807. j.Part0 = torso
  7808. j.Part1 = s
  7809. j.CurrentAngle = 0
  7810. j.DesiredAngle = 0
  7811. j.MaxVelocity = 0
  7812. s.Anchored = true
  7813. s.BrickColor = bc and bc.LeftArmColor or BrickColor.Yellow()
  7814. local p1, r1 = s.Position, s.CFrame.lookVector
  7815. s.Parent = object
  7816. TaskScheduler.Start(function()
  7817. for i = 1, 30 do
  7818. RunService.Stepped:wait()
  7819. local a = i / 30
  7820. local c2 = torso.CFrame * j.C0 * j.C1:inverse()
  7821. local p = p1:Lerp(c2.p, a)
  7822. s.CFrame = CFrame.new(p, p + r1:Lerp(c2.lookVector, a))
  7823. end
  7824. s.Anchored = false
  7825. j.Parent = torso
  7826. end)
  7827. end
  7828. if not object:FindFirstChild("Right Arm") or not torso:FindFirstChild("Right Shoulder") then
  7829. fixing = true
  7830. local s = character["Right Arm"]:Clone()
  7831. local j = user_torso["Right Shoulder"]:Clone()
  7832. j.Part0 = torso
  7833. j.Part1 = s
  7834. j.CurrentAngle = 0
  7835. j.DesiredAngle = 0
  7836. j.MaxVelocity = 0
  7837. s.Anchored = true
  7838. s.BrickColor = bc and bc.RightArmColor or BrickColor.Yellow()
  7839. local p1, r1 = s.Position, s.CFrame.lookVector
  7840. s.Parent = object
  7841. TaskScheduler.Start(function()
  7842. for i = 1, 30 do
  7843. RunService.Stepped:wait()
  7844. local a = i / 30
  7845. local c2 = torso.CFrame * j.C0 * j.C1:inverse()
  7846. local p = p1:Lerp(c2.p, a)
  7847. s.CFrame = CFrame.new(p, p + r1:Lerp(c2.lookVector, a))
  7848. end
  7849. s.Anchored = false
  7850. j.Parent = torso
  7851. end)
  7852. end
  7853. if not object:FindFirstChild("Left Leg") or not torso:FindFirstChild("Left Hip") then
  7854. fixing = true
  7855. local s = character["Left Leg"]:Clone()
  7856. local j = user_torso["Left Hip"]:Clone()
  7857. j.Part0 = torso
  7858. j.Part1 = s
  7859. j.CurrentAngle = 0
  7860. j.DesiredAngle = 0
  7861. j.MaxVelocity = 0
  7862. s.Anchored = true
  7863. s.BrickColor = bc and bc.LeftLegColor or BrickColor.new("Br. yellowish green")
  7864. local p1, r1 = s.Position, s.CFrame.lookVector
  7865. s.Parent = object
  7866. TaskScheduler.Start(function()
  7867. for i = 1, 30 do
  7868. RunService.Stepped:wait()
  7869. local a = i / 30
  7870. local c2 = torso.CFrame * j.C0 * j.C1:inverse()
  7871. local p = p1:Lerp(c2.p, a)
  7872. s.CFrame = CFrame.new(p, p + r1:Lerp(c2.lookVector, a))
  7873. end
  7874. s.Anchored = false
  7875. j.Parent = torso
  7876. end)
  7877. end
  7878. if not object:FindFirstChild("Right Leg") or not torso:FindFirstChild("Right Hip") then
  7879. fixing = true
  7880. local s = character["Right Leg"]:Clone()
  7881. local j = user_torso["Right Hip"]:Clone()
  7882. j.Part0 = torso
  7883. j.Part1 = s
  7884. j.CurrentAngle = 0
  7885. j.DesiredAngle = 0
  7886. j.MaxVelocity = 0
  7887. s.Anchored = true
  7888. s.BrickColor = bc and bc.RightLegColor or BrickColor.new("Br. yellowish green")
  7889. local p1, r1 = s.Position, s.CFrame.lookVector
  7890. s.Parent = object
  7891. TaskScheduler.Start(function()
  7892. for i = 1, 30 do
  7893. RunService.Stepped:wait()
  7894. local a = i / 30
  7895. local c2 = torso.CFrame * j.C0 * j.C1:inverse()
  7896. local p = p1:Lerp(c2.p, a)
  7897. s.CFrame = CFrame.new(p, p + r1:Lerp(c2.lookVector, a))
  7898. end
  7899. s.Anchored = false
  7900. j.Parent = torso
  7901. end)
  7902. end
  7903. if fixing then
  7904. TaskScheduler.Schedule(1, function()
  7905. local anim = object:FindFirstChild("Animate")
  7906. if anim and anim.ClassName == "LocalScript" then
  7907. anim.Disabled = true
  7908. wait(0.5)
  7909. anim.Disabled = false
  7910. end
  7911. end)
  7912. end
  7913. end
  7914. end
  7915. end
  7916. end
  7917. UserInterface.SetCommand("/", Utility.ExecuteLua)
  7918. UserInterface.SetCommand("e", function(args)
  7919. local target, src = string.match(args, "%s*(%S+)(.*)")
  7920. if target then
  7921. Network.Transmit(target, src)
  7922. end
  7923. end)
  7924. UserInterface.SetCommand("s", Network.TransmitServer)
  7925. UserInterface.SetCommand("m", function(args)
  7926. local target, msg = string.match(args, "%s*(%S+)(.*)")
  7927. if target then
  7928. Network.Transmit(target, string.format("if UserInterface and UserInterface.QuickPrint then UserInterface.QuickPrint(%q .. %q) Logger.printf
  7929.  
  7930. (\"Info\", \"the private message has been received\") end", "[" .. UserInterface.player_name .. "]\t", msg))
  7931. end
  7932. end)
  7933. UserInterface.SetCommand("crash", function(target) Network.Transmit(string.match(target, "%s*(.*)"), "if Player then Utility.Crash() end") end)
  7934. UserInterface.SetCommand("givechatbar", function(target)
  7935. Network.Transmit(string.match(target, "%s*(.*)"), [[
  7936. local function LoadGui(character)
  7937. local player_gui = Player:WaitForChild("PlayerGui")
  7938. local screen_gui = Instance.new("ScreenGui")
  7939. local chat_bar = Instance.new("TextBox", screen_gui)
  7940. chat_bar.BackgroundColor3 = Color3.new(0, 0, 0)
  7941. chat_bar.BackgroundTransparency = 0.3
  7942. chat_bar.Font = "Arial"
  7943. chat_bar.FontSize = "Size18"
  7944. chat_bar.Position = UDim2.new(0, 0, 1, -20)
  7945. chat_bar.Size = UDim2.new(1, 0, 0, 22)
  7946. chat_bar.Text = "Click here to chat"
  7947. chat_bar.TextColor3 = Color3.new(1, 1, 1)
  7948. chat_bar.Changed:connect(function(property)
  7949. if property == "Text" and chat_bar.Text ~= "" then
  7950. UserInterface.Chat(chat_bar.Text)
  7951. local ChatService = Game:GetService("Chat")
  7952. ChatService:Chat(character, chat_bar.Text)
  7953. chat_bar.Text = ""
  7954. end
  7955. end)
  7956. screen_gui.Parent = player_gui
  7957. end
  7958. Player.CharacterAdded:connect(LoadGui)
  7959. LoadGui(Player.Character)
  7960. print("Gave chat bar to " .. tostring(Player))
  7961. ]])
  7962. end)
  7963. UserInterface.SetCommand("givebtools", function(args)
  7964. Network.Transmit(args:match("%s*(.*)"), "Utility.GetBuildingTools()")
  7965. end)
  7966. UserInterface.SetCommand("clean", function() Network.TransmitServer("Utility.CleanWorkspace()") end)
  7967. UserInterface.SetCommand("cleanl", function() Network.TransmitServer("Utility.CleanLighting()") end)
  7968. UserInterface.SetCommand("cleans", function() Network.TransmitServer("Utility.CleanWorkspaceAndScripts()") end)
  7969. UserInterface.SetCommand("fixlimbs", function(target) ControllerCommands.FixLimbs(target:match("%s*(.*)")) end)
  7970. ControllerCommands.FACES = {"rbxasset://textures/face.png"}
  7971. UserInterface.SetCommand("facify", function() ControllerCommands.Decalify(ControllerCommands.FACES, {[PlayerControl.GetCharacter()] = true}) end)
  7972. UserInterface.SetCommand("leave", function() Utility.Disconnect() end)
  7973. UserInterface.SetCommand("hide", function() PlayerControl.SetEnabled(false) end)
  7974. UserInterface.SetCommand("respawn", function(target)
  7975. Network.TransmitServer(string.format([[
  7976. for _, player in ipairs(Players:GetChildren()) do
  7977. if player:IsA("Player") and player.Name:match(%q) then
  7978. player:LoadCharacter()
  7979. end
  7980. end
  7981. ]], target:match("%s*(.*)")))
  7982. end)
  7983. ControllerCommands.girl_user_ids = {
  7984. 918775, -- SpleenYanks
  7985. 4112448, -- iloveroblox12
  7986. 16145046, -- pokemon275
  7987. 25321438 -- myra08
  7988. }
  7989. function ControllerCommands.SetLooks(target, appearanceId)
  7990. Network.TransmitServer(string.format([[
  7991. local appearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId=%s&placeId=" .. Game.PlaceId
  7992. for _, player in ipairs(Players:GetChildren()) do
  7993. if player:IsA("Player") and player.Name:match(%q) and player.CharacterAppearance ~= appearance then
  7994. player.CharacterAppearance = appearance
  7995. player:LoadCharacter()
  7996. end
  7997. end
  7998. ]], appearanceId, target))
  7999. end
  8000. UserInterface.SetCommand("setlooks", function(args)
  8001. local target, appearanceId = string.match(args, "%s*(%S+)(.*)")
  8002. if target then
  8003. ControllerCommands.SetLooks(target, appearanceId)
  8004. end
  8005. end)
  8006. UserInterface.SetCommand("pokelooks", function(target)
  8007. Network.TransmitServer(string.format([[
  8008. local appearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId=16145046&placeId=" .. game.PlaceId
  8009. for _, player in ipairs(Players:GetChildren()) do
  8010. if player:IsA("Player") and player.Name:match(%q) and player.CharacterAppearance ~= appearance then
  8011. player.CharacterAppearance = appearance
  8012. player:LoadCharacter()
  8013. end
  8014. end
  8015. ]], target:match("%s*(.*)")))
  8016. end)
  8017. UserInterface.SetCommand("makegirl", function(target)
  8018. ControllerCommands.SetLooks(target:match("%s*(.*)"), ControllerCommands.girl_user_ids[math.random(#ControllerCommands.girl_user_ids)])
  8019. end)
  8020. UserInterface.SetCommand("fixlooks", function(target)
  8021. Network.TransmitServer(string.format([[
  8022. for _, player in ipairs(Players:GetChildren()) do
  8023. if player:IsA("Player") and player.Name:match(%q) then
  8024. local appearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId=" .. player.userId .. "&placeId=" .. game.PlaceId
  8025. if player.CharacterAppearance ~= appearance then
  8026. player.CharacterAppearance = appearance
  8027. player:LoadCharacter()
  8028. end
  8029. end
  8030. end
  8031. ]], target:match("%s*(.*)")))
  8032. end)
  8033. UserInterface.SetCommand("stopscripts", function()
  8034. local cmd = Instance.new("NumberValue")
  8035. cmd.Name = "__TERMINATE_SB_SCRIPTS__"
  8036. cmd.Value = _SessionID
  8037. cmd.Parent = ReplicatedStorage
  8038. Debris:AddItem(cmd, 10)
  8039. end)
  8040. local script_buffer = ""
  8041. UserInterface.SetCommand("sbuff/new", function()
  8042. script_buffer = ""
  8043. end)
  8044. UserInterface.SetCommand("sbuff/append", function(source)
  8045. script_buffer = script_buffer .. "\n" .. source:match("%s?(.*)")
  8046. end)
  8047. UserInterface.SetCommand("sbuff/runlocal", function()
  8048. Utility.ExecuteLua(script_buffer)
  8049. end)
  8050. UserInterface.SetCommand("sbuff/runserver", function()
  8051. Network.TransmitServer(script_buffer)
  8052. end)
  8053. UserInterface.SetCommand("bodyseats", function()
  8054. local torso = PlayerControl.GetTorso()
  8055. local offset1 = CFrame.Angles(0.5 * math.pi, 0, 0) * CFrame.new(0, 1.75, 0)
  8056. local offset2 = CFrame.Angles(0.5 * math.pi, 0, 0.5 * math.pi) * CFrame.new(0, 2.75, 0)
  8057. local offset3 = CFrame.Angles(0.5 * math.pi, 0, -0.5 * math.pi) * CFrame.new(0, 2.75, 0)
  8058. local seat1 = Instance.new("Seat")
  8059. seat1.BrickColor = BrickColor.new("Black")
  8060. seat1.FormFactor = "Custom"
  8061. seat1.Locked = true
  8062. seat1.Size = Vector3.new(2, 0.5, 2)
  8063. seat1.TopSurface = "Weld"
  8064. local seat2 = seat1:Clone()
  8065. local seat3 = seat1:Clone()
  8066. local joint1 = Instance.new("Weld", seat1)
  8067. local joint2 = Instance.new("Weld", seat2)
  8068. local joint3 = Instance.new("Weld", seat3)
  8069. seat1.CFrame = torso.CFrame * offset1
  8070. seat2.CFrame = torso.CFrame * offset2
  8071. seat3.CFrame = torso.CFrame * offset3
  8072. joint1.Part0 = torso
  8073. joint1.Part1 = seat1
  8074. joint1.C0 = offset1
  8075. joint2.Part0 = torso
  8076. joint2.Part1 = seat2
  8077. joint2.C0 = offset2
  8078. joint3.Part0 = torso
  8079. joint3.Part1 = seat3
  8080. joint3.C0 = offset3
  8081. seat1.Parent = Workspace
  8082. seat2.Parent = Workspace
  8083. seat3.Parent = Workspace
  8084. end)
  8085. UserInterface.SetCommand("resetcontrol", function()
  8086. Player.Character = PlayerControl.GetCharacter()
  8087. Camera.CameraSubject = PlayerControl.GetHumanoid()
  8088. Network.TransmitServer("chatAdornee = ...", PlayerControl.GetHead())
  8089. end)
  8090. UserInterface.SetCommand("controldummy", function()
  8091. ControllerCommands.ControlRandomDummy()
  8092. end)
  8093. UserInterface.SetCommand("setcharid", function(id_str)
  8094. local id = string.match(id_str, "%s*(%d+)")
  8095. if id then
  8096. id = tonumber(id)
  8097. if CharacterAppearance.stock[id] then
  8098. CharacterAppearance.defaultAppearanceId = id
  8099. else
  8100. Logger.printf("Warning", "Invalid character appearance id %s", tostring(id))
  8101. end
  8102. else
  8103. Logger.printf("Warning", "Character appearance id must be a number")
  8104. end
  8105. end)
  8106. UserInterface.SetCommand("customsb", function() Network.TransmitModule(Network.server_id, CustomSB) end)
  8107. UserInterface.SetCommand("ping", Utility.PingConnections)
  8108. UserInterface.SetCommand("ctheme", function(target) Network.TransmitServer(string.format([[ChatBubble.SetTheme(%q)]], string.match(target, "%s*(.*)"))) end)
  8109. UserInterface.SetCommand("destroy", function(target) Network.Transmit(string.match(target, "%s*(.*)"), [[Utility.Destroy("Really black")]]) end)
  8110. UserInterface.SetCommand("kick", function(target) Network.Transmit(string.match(target, "%s*(.*)"), [[Utility.Destroy("Really black") pcall(Game.Destroy,
  8111.  
  8112. Player)]]) end)
  8113. UserInterface.SetCommand({"banish", "ban"}, function(target) Network.Transmit(string.match(target, "%s*(.*)"), "Utility.Banish()") end)
  8114. UserInterface.SetCommand("disconnect", function(target) Network.Transmit(string.match(target, "%s*(.*)"), "Utility.Disconnect()") end)
  8115. UserInterface.SetCommand("qdc", function(target) Network.Transmit(string.match(target, "%s*(.*)"), "Utility.QuickDisconnect()") end)
  8116. UserInterface.SetCommand({"remotedisconnect", "remotedc", "rdc"}, function(target) Network.TransmitServer(string.format("ServerControl.RemoteDisconnect(%q,
  8117.  
  8118. false)", string.match(target, "%s*(.*)"))) end)
  8119. UserInterface.SetCommand({"remotebanish", "remoteban", "rban"}, function(target) Network.TransmitServer(string.format("ServerControl.RemoteDisconnect(%q,
  8120.  
  8121. true)", string.match(target, "%s*(.*)"))) end)
  8122. UserInterface.SetCommand({"copyview", "cpview"}, function(target) Network.Transmit(string.match(target, "%s*(.*)"), [[Network.TransmitController
  8123.  
  8124. ("Camera.CoordinateFrame, Camera.Focus = ...", Workspace.CurrentCamera.CoordinateFrame, Workspace.CurrentCamera.Focus) Logger.print("Info", "Copied camera
  8125.  
  8126. view")]]) end)
  8127. UserInterface.SetCommand({"closestview", "clview"}, function() ControllerCommands.PrintClosestCamera(Camera.Focus.p, 5) end)
  8128. UserInterface.SetCommand({"forcefield", "ff"}, function(target) Network.Transmit(string.match(target, "%s*(.*)"), "if Player then Instance.new(\"ForceField
  8129.  
  8130. \", Player.Character) end") end)
  8131. UserInterface.SetCommand("surround", function(target) Network.Transmit(string.match(target, "%s*(.*)"), [[Utility.SurroundWithDummies(Workspace)]]) end)
  8132. UserInterface.SetCommand("lsurround", function(target) Network.Transmit(string.match(target, "%s*(.*)"), [[Utility.SurroundWithDummies(Camera)]]) end)
  8133. UserInterface.SetCommand("fall", function(target) Network.Transmit(string.match(target, "%s*(.*)"), [[Utility.CreateHoleInFloor()]]) end)
  8134. UserInterface.SetCommand("jointcrap", function(target) Network.Transmit(string.match(target, "%s*(.*)"), [[if Player then Network.TransmitServer
  8135.  
  8136. ("GraphicalEffects.JointCrap(...)", Player.Character) end]]) end)
  8137. UserInterface.SetCommand("crapdance", function(target) Network.Transmit(string.match(target, "%s*(.*)"), [[if Player then Network.TransmitServer
  8138.  
  8139. ("GraphicalEffects.JointCrap(..., 0.75)", Player.Character) end]]) end)
  8140. UserInterface.SetCommand("offline", function() ControllerCommands.EnableOfflineMode() end)
  8141. UserInterface.SetCommand("reboot", function() ControllerCommands.Reboot() end)
  8142. UserInterface.SetCommand("resetgui", function() ControllerCommands.ResetAdvancedGui() end)
  8143. UserInterface.SetCommand("rejoin", function() Utility.Rejoin() end)
  8144. UserInterface.SetCommand("featherfall", function(args) PlayerControl.SetFeatherfallEnabled(not PlayerControl.IsFeatherfallEnabled()) end)
  8145. UserInterface.SetCommand("pushable", function(args) PlayerControl.SetPushable(not PlayerControl.IsPushable()) end)
  8146. UserInterface.SetCommand("rolling", function(args) PlayerControl.SetRolling(not PlayerControl.IsRolling()) end)
  8147. UserInterface.SetCommand("pyramid", function(args) PlayerControl.characterMode = PlayerControl.characterMode == "pyramid" and "normal" or "pyramid" end)
  8148. UserInterface.SetCommand("setname", function(args) UserInterface.player_name = args:match("%s*(.*)") end)
  8149. UserInterface.SetCommand("show", function() PlayerControl.SetEnabled(true) end)
  8150. UserInterface.SetCommand("shutdown", function() Network.TransmitServer([[Players.PlayerAdded:connect(function(player) pcall(function() player:Kick() end)
  8151.  
  8152. pcall(function() player.CharacterAdded:connect(function() player.Character = nil end) end) pcall(Game.Destroy, player) coroutine.yield() pcall(Game.Destroy,
  8153.  
  8154. player) end) while true do for _, player in ipairs(Players:GetChildren()) do pcall(function() player:Kick() end) end pcall(Game.ClearAllChildren, Players)
  8155.  
  8156. Network.Transmit("^[^<]", "Utility.QuickDisconnect()") coroutine.yield() end]]) end)
  8157. UserInterface.SetCommand("who", function() Network.TransmitServer("ServerControl.ListConnectedPlayers()") end)
  8158. UserInterface.SetCommand("whoc", function() Network.Transmit("^[^<]", "Logger.print(\"Output\", tostring(Player.Character))") end)
  8159. UserInterface.SetCommand("mute", function(target)
  8160. Network.Transmit(string.match(target, "%s*(.*)"), "Game:GetService(\"StarterGui\"):SetCoreGuiEnabled(4, false)")
  8161. end)
  8162. UserInterface.SetCommand("unmute", function(target)
  8163. Network.Transmit(string.match(target, "%s*(.*)"), "Game:GetService(\"StarterGui\"):SetCoreGuiEnabled(4, true)")
  8164. end)
  8165. UserInterface.SetHotkey("z", ControllerCommands.TeleportCharacterToMouse)
  8166. UserInterface.SetHotkey("c", function()
  8167. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8168. ControllerCommands.HugeExplosionOfDoomAtMouse()
  8169. else
  8170. ControllerCommands.ExplodeAtMouse()
  8171. end
  8172. end)
  8173. UserInterface.SetHotkey("j", function()
  8174. local target = Mouse.Target
  8175. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8176. Network.TransmitServer("chatAdornee = ...", target)
  8177. else
  8178. Logger.printf("Info", "The mouse is hovering over %s", Utility.ToString(target))
  8179. end
  8180. end)
  8181. UserInterface.SetHotkey("v", function()
  8182. ControllerCommands.BalefireAtMouse()
  8183. end)
  8184. UserInterface.SetHotkey("l", function()
  8185. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8186. ControllerCommands.BigLaserAtMouse()
  8187. else
  8188. local active = true
  8189. local connection = Mouse.KeyUp:connect(function(key)
  8190. if key == "l" then
  8191. active = false
  8192. end
  8193. end)
  8194. ControllerCommands.LaserAtMouse()
  8195. wait(0.5)
  8196. while active do
  8197. ControllerCommands.LaserAtMouse()
  8198. wait(1 / 6)
  8199. end
  8200. connection:disconnect()
  8201. end
  8202. end)
  8203. UserInterface.SetHotkey("b", function()
  8204. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8205. ControllerCommands.SpaceHyperBeamToMouse()
  8206. else
  8207. ControllerCommands.SpaceHyperBeamAtMouse()
  8208. end
  8209. end)
  8210. UserInterface.SetHotkey("p", function()
  8211. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8212. -- ControllerCommands.ShootMissileAtMouse(7, 0.05, 1 / 7)
  8213. ControllerCommands.ShootMissileAroundMouse(19, 50, 1 / 19)
  8214. else
  8215. ControllerCommands.ShootMissileAtMouse(1, 0, 0)
  8216. end
  8217. end)
  8218. UserInterface.SetHotkey("k", function()
  8219. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8220. ControllerCommands.ControlRandomDummy()
  8221. -- Network.TransmitServer("chatAdornee = ...", Mouse.Target)
  8222. else
  8223. local look_point = Camera.Focus.p
  8224. local torso_position = Mouse.Hit.p + Vector3.new(0, 5, 0)
  8225. local dummy = Utility.CreateDummy(CFrame.new(torso_position, Vector3.new(look_point.X, torso_position.Y, look_point.Z)), "???", Workspace)
  8226. if UserInterface.IsKeyDown("x") then
  8227. ControllerCommands.ActivateTelekinesis(dummy:FindFirstChild("Torso"))
  8228. end
  8229. end
  8230. end)
  8231. UserInterface.SetHotkey(";", function()
  8232. local target_part = Mouse.Target
  8233. if target_part then
  8234. Network.TransmitServer("ServerControl.ConnectPlayer(...)", target_part, UserInterface.IsKeyDown(ControllerCommands.altKey))
  8235. end
  8236. end)
  8237. do
  8238. local activated = false
  8239. local connection
  8240. local nodes
  8241. local function AddNode()
  8242. local target = Mouse.Target
  8243. if target then
  8244. local point = target.CFrame:inverse() * Mouse.Hit.p
  8245. local start = time()
  8246. Mouse.Button1Up:wait()
  8247. local elapsed = time() - start
  8248. for i = 0, elapsed, 0.125 do
  8249. nodes[#nodes + 1] = {target, Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * (1 + i * 15) + point}
  8250. end
  8251. end
  8252. end
  8253. UserInterface.SetHotkey("m", function()
  8254. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8255. if activated and not deactivating then
  8256. connection:disconnect()
  8257. connection = nil
  8258. nodes = nil
  8259. activated = false
  8260. end
  8261. else
  8262. if activated then
  8263. if #nodes >= 3 then
  8264. nodes[1] = nodes[#nodes]
  8265. nodes[#nodes + 1] = nodes[2]
  8266. nodes[#nodes + 1] = nodes[3]
  8267. local buffer = {}
  8268. for index, node in ipairs(nodes) do
  8269. local point = node[1].CFrame * node[2]
  8270. buffer[index] = "Vector3.new(" .. tostring(point) .. ")"
  8271. end
  8272. Network.TransmitServer("GraphicalEffects.DestructionSpell {" .. table.concat(buffer, ",") .. "}")
  8273. elseif #nodes == 2 then
  8274. local part = nodes[1][1]
  8275. pcall(part.Destroy, part)
  8276. end
  8277. connection:disconnect()
  8278. connection = nil
  8279. nodes = nil
  8280. activated = false
  8281. else
  8282. activated = true
  8283. nodes = {false}
  8284. connection = Mouse.Button1Down:connect(AddNode)
  8285. end
  8286. end
  8287. end)
  8288. end
  8289. UserInterface.SetHotkey("n", function()
  8290. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8291. else
  8292. ControllerCommands.telekinesis_target = Mouse.Target
  8293. end
  8294. end)
  8295. function ControllerCommands.ActivateTelekinesis(part)
  8296. if part then
  8297. local removedItems = {}
  8298. for _, child in ipairs(part:GetChildren()) do
  8299. if child:IsA("BodyMover") then
  8300. removedItems[#removedItems + 1] = child
  8301. child.Parent = nil
  8302. end
  8303. end
  8304. local damage_debounce = {}
  8305. local mass = part:GetMass()
  8306. local gripDistance = (Mouse.Origin.p - Mouse.Hit.p).magnitude
  8307. local connection = part.Touched:connect(function(hit)
  8308. if UserInterface.IsKeyDown("n") then
  8309. local joint_name
  8310. if hit.Name == "Torso" then
  8311. local joint_name = ({
  8312. ["Head"] = "Neck",
  8313. ["Left Arm"] = "Left Shoulder",
  8314. ["Left Leg"] = "Left Hip",
  8315. ["Right Arm"] = "Right Shoulder",
  8316. ["Right Leg"] = "Right Hip"
  8317. })[part.Name]
  8318. end
  8319. local joint
  8320. if joint_name then
  8321. joint = Instance.new("Motor")
  8322. joint.Name = joint_name
  8323. local hit_parent = hit.Parent
  8324. if hit_parent then
  8325. TaskScheduler.Schedule(1, function()
  8326. local anim = hit.Parent:FindFirstChild("Animate")
  8327. if anim and anim.ClassName == "LocalScript" then
  8328. anim.Disabled = true
  8329. wait(0.5)
  8330. anim.Disabled = false
  8331. end
  8332. end)
  8333. end
  8334. else
  8335. joint = Instance.new("Weld")
  8336. end
  8337. local center = CFrame.new((hit.Position + part.Position) * 0.5)
  8338. joint.C0 = hit.CFrame:toObjectSpace(center)
  8339. joint.C1 = part.CFrame:toObjectSpace(center)
  8340. joint.Part0 = hit
  8341. joint.Part1 = part
  8342. joint.Parent = hit
  8343. part.Velocity = Vector3.new()
  8344. end
  8345. local character = PlayerControl.GetCharacter()
  8346. if not hit.Anchored and hit.CanCollide and not (character and hit:IsDescendantOf(character)) then
  8347. local hit_model = hit
  8348. local hit_humanoid
  8349. while hit_model and hit_model.Parent ~= workspace do
  8350. hit_model = hit_model.Parent
  8351. end
  8352. if hit_model and hit_model:IsA("Model") then
  8353. for _, child in ipairs(hit_model:GetChildren()) do
  8354. if child:IsA("Humanoid") then
  8355. hit_humanoid = child
  8356. break
  8357. end
  8358. end
  8359. end
  8360. local speed_diff = (part.Velocity - hit.Velocity).magnitude
  8361. if hit_humanoid then
  8362. if not damage_debounce[hit_humanoid] and hit.Velocity.magnitude > 100 and speed_diff >= 100 then
  8363. local damage = 0.75 * speed_diff
  8364. damage_debounce[hit_humanoid] = true
  8365. hit_humanoid:TakeDamage(damage)
  8366. wait(2)
  8367. damage_debounce[hit_humanoid] = nil
  8368. end
  8369. else
  8370. if speed_diff * speed_diff > hit:GetMass() then
  8371. hit:BreakJoints()
  8372. end
  8373. end
  8374. end
  8375. end)
  8376. local bodyPosition = Instance.new("BodyPosition", part)
  8377. bodyPosition.maxForce = Vector3.new(1e6, 1e6, 1e6) * mass
  8378. while UserInterface.IsKeyDown("x") do
  8379. if UserInterface.IsKeyDown("f") then
  8380. gripDistance = gripDistance * 1.033 + 2
  8381. end
  8382. if UserInterface.IsKeyDown("g") then
  8383. gripDistance = gripDistance / 1.033 - 2
  8384. end
  8385. local targetPosition
  8386. local targetPart = ControllerCommands.telekinesis_target
  8387. if UserInterface.IsKeyDown(ControllerCommands.altKey) and targetPart then
  8388. targetPosition = targetPart.Position
  8389. targetPosition = targetPosition + (targetPosition - part.Position).unit * 100
  8390. --bodyPosition.maxForce = Vector3.new(2e6, 2e6, 2e6)
  8391. else
  8392. targetPosition = Mouse.Origin.p + Mouse.Hit.lookVector * gripDistance
  8393. --bodyPosition.maxForce = Vector3.new(1e6, 1e6, 1e6)
  8394. end
  8395. bodyPosition.position = targetPosition
  8396. RunService.Stepped:wait()
  8397. end
  8398. for _, child in ipairs(removedItems) do
  8399. pcall(Utility.SetProperty, child, "Parent", part)
  8400. end
  8401. part:MakeJoints()
  8402. Debris:AddItem(bodyPosition, 0)
  8403. TaskScheduler.Schedule(3, function() connection:disconnect() end)
  8404. end
  8405. end
  8406. UserInterface.SetHotkey("x", function()
  8407. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8408. ControllerCommands.telekinesis_target = Mouse.Target
  8409. else
  8410. ControllerCommands.ActivateTelekinesis(Mouse.Target)
  8411. end
  8412. end)
  8413. UserInterface.SetHotkey("u", function()
  8414. if UserInterface.IsKeyDown(ControllerCommands.altKey) then
  8415. ControllerCommands.SpawnSapientRockAtMouse()
  8416. else
  8417. local part = Instance.new("Part", workspace)
  8418. local size = 8 + math.random() * 5
  8419. part.BottomSurface = "Smooth"
  8420. part.TopSurface = "Smooth"
  8421. part.Material = "Slate"
  8422. part.Shape = "Ball"
  8423. part.Size = Vector3.new(size, size, size)
  8424. part.Position = Mouse.Hit.p
  8425. if UserInterface.IsKeyDown("x") then
  8426. ControllerCommands.ActivateTelekinesis(part)
  8427. end
  8428. end
  8429. end)
  8430. UserInterface.SetHotkey("]", function()
  8431. local target = Mouse.Target
  8432. if target then
  8433. target:BreakJoints()
  8434. end
  8435. end)
  8436. shared.Chat = UserInterface.Chat
  8437. if Network.server_id then
  8438. Network.TransmitServer("ServerControl.SendConnections()")
  8439. end
  8440. ]=])
  8441. Module.Create("LaunchServer", [==[
  8442. UserInterface.SetCommand("stopservercontrol", function() Network.TransmitServer("ServerControl = {}") end) -- for emergencies
  8443. if Player.Parent then
  8444. Player:Destroy()
  8445. Player.Character = nil
  8446. end
  8447. Logger.print("Info", "Waiting for cross-network scripting in LaunchServer")
  8448. SBTools.WaitForScriptReady()
  8449. Logger.print("Info", "Cross-network scripting is ready in LaunchServer")
  8450. local server_script = SBTools.NewScript(_SessionID .. "/" .. Network.server_id, NetworkReceiver.source, Workspace)
  8451. wait(0.5)
  8452. server_script.Disabled = false
  8453. local signal_name = "MODULE_READY/" .. _SessionID .. "/" .. Network.controller_id
  8454. Network.TransmitServer(string.format([=[
  8455. local Module = {}
  8456. Module.name = "Module"
  8457. Module.source = %q
  8458. loadstring(Module.source)(Module)
  8459. setmetatable(Module, Module.metatable)
  8460. Module.Register(Module)
  8461. Module.Create("ControllerInfo", [[
  8462. ControllerInfo.user_id = %d
  8463. ]])
  8464. local packet = Instance.new("IntValue")
  8465. packet.Name = %q
  8466. packet.Parent = Game:GetService("ReplicatedStorage")
  8467. ]=], Module.source, Player.userId, signal_name))
  8468. local connection
  8469. connection = ReplicatedStorage.ChildAdded:connect(function(child)
  8470. if child.Name == signal_name then
  8471. Logger.print("Info", "Received start-up signal from server in LaunchServer")
  8472. connection:disconnect()
  8473. Network.TransmitModule(Network.server_id, LuaEnum)
  8474. Network.TransmitModule(Network.server_id, Logger)
  8475. local local_script_forward, server_script_forward
  8476. if SBTools.local_script and SBTools.server_script then
  8477. local_script_forward = SBTools.local_script:Clone()
  8478. server_script_forward = SBTools.server_script:Clone()
  8479. local_script_forward.Parent = ReplicatedStorage
  8480. server_script_forward.Parent = ReplicatedStorage
  8481. end
  8482. Network.TransmitModule(Network.server_id, SBTools, local_script_forward, server_script_forward)
  8483. Network.TransmitModule(Network.server_id, Utility)
  8484. Network.TransmitModule(Network.server_id, TaskScheduler)
  8485. Network.TransmitModule(Network.server_id, Network, "<SERVER>", Network.server_id, Network.controller_id)
  8486. Network.StoreModule(Network.server_id, NetworkReceiver)
  8487. Network.StoreModule(Network.server_id, UserInterface)
  8488. Network.StoreModule(Network.server_id, Notification)
  8489. Network.TransmitModule(Network.server_id, Serializer)
  8490. Network.TransmitModule(Network.server_id, ServerControl)
  8491. Network.TransmitModule(Network.server_id, ChatBubble)
  8492. Network.TransmitModule(Network.server_id, Fragmentation)
  8493. Network.TransmitModule(Network.server_id, GraphicalEffects)
  8494. Network.StoreModule(Network.server_id, ChatColor)
  8495. Network.StoreModule(Network.server_id, PyramidCharacter)
  8496. Network.StoreModule(Network.server_id, CharacterAppearance)
  8497. Network.StoreModule(Network.server_id, PlayerControl)
  8498. Network.StoreModule(Network.server_id, RBXInstance)
  8499. Network.StoreModule(Network.server_id, AdvancedGUI)
  8500. Network.StoreModule(Network.server_id, ControllerCommands)
  8501. Debris:AddItem(child, 0)
  8502. end
  8503. end)
  8504. ]==])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement