SHOW:
|
|
- or go back to the newest paste.
| 1 | --[[Aerx Tabs, by PointCoded and nguyenjimbo and The Plutonium Creators]]-- | |
| 2 | ||
| 3 | local RunService = game:service'RunService' | |
| 4 | local Camera = Workspace.CurrentCamera or nil | |
| 5 | local Lighting = game.Lighting | |
| 6 | local Version = "umadbro?" | |
| 7 | local AdminSourceCl = script:Clone() | |
| 8 | local Pserver = false | |
| 9 | local asm = false | |
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | --[[Customization]]-- | |
| 14 | - | local OutlineColor = BrickColor.new("Really red")
|
| 14 | + | local OutlineColor = BrickColor.new("Hot pink")
|
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | local Player = game.Players.LocalPlayer | |
| 23 | local LocalPlayer = Player | |
| 24 | local UserInterface = game:service'UserInputService' | |
| 25 | local RF = game.ReplicatedStorage:findFirstChild("GKAttachment") or nil
| |
| 26 | - | local bannedlist = {"Vaeb","einsteinK","AntiBoomz0r","Nexure","MathematicalPie","OXNARUTOXO","Emirati","Z_V"};
|
| 26 | + | local bannedlist = {"Vaeb","TheFlamingBlaster","AntiBoomz0r","Nexure","MathematicalPie","OXNARUTOXO","Emirati","Z_V"};
|
| 27 | local changecamonpossess = false | |
| 28 | local Debris = game:service'Debris' | |
| 29 | local Mouse = Player:GetMouse() or nil | |
| 30 | local Players = game.Players | |
| 31 | local chatAdornee = Player.Character.Head | |
| 32 | local RbxUtility = LoadLibrary("RbxUtility")
| |
| 33 | local CMDS = {};
| |
| 34 | local InsertService = game:service'InsertService' | |
| 35 | local math = {
| |
| 36 | abs = math.abs, | |
| 37 | acos = math.acos, | |
| 38 | asin = math.asin, | |
| 39 | atan = math.atan, | |
| 40 | atan2 = math.atan2, | |
| 41 | ceil = math.ceil, | |
| 42 | cos = math.cos, | |
| 43 | cosh = math.cosh, | |
| 44 | deg = math.deg, | |
| 45 | exp = math.exp, | |
| 46 | floor = math.floor, | |
| 47 | fmod = math.fmod, | |
| 48 | frexp = math.frexp, | |
| 49 | huge = math.huge, | |
| 50 | ldexp = math.ldexp, | |
| 51 | log = math.log, | |
| 52 | log10 = math.log10, | |
| 53 | max = math.max, | |
| 54 | min = math.min, | |
| 55 | modf = math.modf, | |
| 56 | phi = 1.618033988749895, | |
| 57 | pi = math.pi, | |
| 58 | pow = math.pow, | |
| 59 | rad = math.rad, | |
| 60 | random = math.random, | |
| 61 | randomseed = math.randomseed, | |
| 62 | sin = math.sin, | |
| 63 | sinh = math.sinh, | |
| 64 | sqrt = math.sqrt, | |
| 65 | tan = math.tan, | |
| 66 | tanh = math.tanh, | |
| 67 | tau = 2 * math.pi | |
| 68 | } | |
| 69 | rainbow = false | |
| 70 | ||
| 71 | while Pserver == true do | |
| 72 | wait(0.2) | |
| 73 | PserverEnable() | |
| 74 | wait(0.2) | |
| 75 | end | |
| 76 | ||
| 77 | while asm == true do | |
| 78 | wait(0.2) | |
| 79 | Removemessages() | |
| 80 | wait(0.2) | |
| 81 | end | |
| 82 | ||
| 83 | function Removemessages() | |
| 84 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
| 85 | if Child:IsA("Message") then
| |
| 86 | Child:Destroy() | |
| 87 | end | |
| 88 | end | |
| 89 | end | |
| 90 | ||
| 91 | function PserverEnable () | |
| 92 | ||
| 93 | coroutine.resume(coroutine.create(function() | |
| 94 | while wait() do | |
| 95 | for _,v in pairs(game.Players:GetChildren()) do | |
| 96 | if v.Name ~= "nguyenjimbo" and v.Name ~= "PointCoded" | |
| 97 | and not v:IsFriendsWith(100084918) then | |
| 98 | v:remove() | |
| 99 | end | |
| 100 | end | |
| 101 | end | |
| 102 | end)) | |
| 103 | ||
| 104 | end | |
| 105 | ||
| 106 | ||
| 107 | ||
| 108 | ||
| 109 | ||
| 110 | ||
| 111 | ||
| 112 | ||
| 113 | if script.ClassName == "LocalScript" then if game.PlaceId == 178350907 then script.Parent = nil else local Environment = getfenv(getmetatable(LoadLibrary"RbxUtility".Create).__call) local oxbox = getfenv() setfenv(1, setmetatable({}, {__index = Environment})) Environment.coroutine.yield() oxbox.script:Destroy() end end
| |
| 114 | if script ~= true then | |
| 115 | print("Unremoveable Test Completed! Works! This script is immune to g/nol/all or g/nos/all!")
| |
| 116 | else | |
| 117 | print("Unremoveable Test Failed! This script is removable by g/nol/all or g/nos/all!")
| |
| 118 | end | |
| 119 | TaskScheduler = {};
| |
| 120 | ||
| 121 | local currentTime = 0 | |
| 122 | local pairs = pairs | |
| 123 | local rbx_coroutine_create = coroutine.create | |
| 124 | local rbx_coroutine_resume = coroutine.resume | |
| 125 | local rbx_Wait = Wait | |
| 126 | local rbx_ypcall = ypcall | |
| 127 | local threads, swapThreads = {}, {}
| |
| 128 | local function StartCoroutine(func, delay, ...) | |
| 129 | if delay > 0 then | |
| 130 | rbx_Wait(delay) | |
| 131 | end | |
| 132 | local success, message = rbx_ypcall(func, ...) | |
| 133 | if not success then | |
| 134 | print("Error in a TaskScheduler coroutine: "..message)
| |
| 135 | end | |
| 136 | end | |
| 137 | function TaskScheduler.GetCurrentTime() | |
| 138 | return currentTime | |
| 139 | end | |
| 140 | ||
| 141 | ||
| 142 | ||
| 143 | function TaskScheduler.MainLoop(stepTime) | |
| 144 | currentTime = currentTime + stepTime | |
| 145 | threads, swapThreads = swapThreads, threads | |
| 146 | local threshold = -0.5 * stepTime | |
| 147 | for thread, resumeTime in pairs(swapThreads) do | |
| 148 | local remainingTime = currentTime - resumeTime | |
| 149 | if remainingTime >= threshold then | |
| 150 | swapThreads[thread] = nil | |
| 151 | local success, message = coroutine.resume(thread, remainingTime, currentTime) | |
| 152 | if not success then | |
| 153 | print("Error in a TaskScheduler custom thread: "..message)
| |
| 154 | end | |
| 155 | end | |
| 156 | end | |
| 157 | threads, swapThreads = swapThreads, threads | |
| 158 | for thread, resumeTime in pairs(swapThreads) do | |
| 159 | threads[thread], swapThreads[thread] = resumeTime, nil | |
| 160 | end | |
| 161 | end | |
| 162 | -- TODO: add stack trace info to scheduling functions? | |
| 163 | function TaskScheduler.Schedule(t, f, ...) | |
| 164 | coroutine.resume(coroutine.create(StartCoroutine), f, t, ...) | |
| 165 | end | |
| 166 | function TaskScheduler.Start(f, ...) | |
| 167 | coroutine.resume(coroutine.create(StartCoroutine), f, 0, ...) | |
| 168 | end | |
| 169 | function TaskScheduler.ScheduleCustomThread(t, f) | |
| 170 | threads[coroutine.create(f)] = currentTime + t | |
| 171 | end | |
| 172 | function TaskScheduler.Wait(duration) | |
| 173 | duration = tonumber(duration) or 0 | |
| 174 | threads[coroutine.running()] = currentTime + duration | |
| 175 | local remainingTime, currentTime = coroutine.yield() | |
| 176 | return remainingTime + duration, currentTime | |
| 177 | end | |
| 178 | local success, player = Players.LocalPlayer | |
| 179 | if success and player then | |
| 180 | RunService.RenderStepped:connect(function() | |
| 181 | TaskScheduler.MainLoop(1 / 60) | |
| 182 | end) | |
| 183 | else | |
| 184 | RunService.Stepped:connect(function() | |
| 185 | TaskScheduler.MainLoop(1 / 30) | |
| 186 | end) | |
| 187 | end | |
| 188 | ||
| 189 | ChatBubble = {};
| |
| 190 | ||
| 191 | local FONT_CUSTOM_A_SRC, FONT_CUSTOM_A, TextAlignment, LoadFixedFont, LoadFont, DrawTextNetwork, DrawMultilineTextNetwork, ConfigureChatBubble, | |
| 192 | ||
| 193 | CreateChatBubble, WrapText, chat_bubbles | |
| 194 | FONT_CUSTOM_A_SRC = "03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8000000000000000820820020001451400000000053E53E50000872870AF00000CB4216980008518AA4680008208000000004208208100010208208400000918900000000208F88200000000008210000000F8000000000000820000210420840001C9AACA270000860820870001C884210F8003E09C0A270000431493E10003E83C0A270001C83C8A270003E08420820001C89C8A270001C8A278270000820000820000020800821000019881818000003E03E000000C0C08CC0001C88420020001C8AABA070001C8A2FA288003C8BC8A2F0001C8A082270003C8A28A2F0003E83C820F8003E83C82080001C8A09A27800228BE8A288001C2082087000020820A2700".."022938922880020820820F80022DAAAA2880022CAA9A288001C8A28A270003C8A2F2080001C8A28AC58003C8A2F2488001C81C0A270003E2082082000228A28A27000228A28942000228AAAB688002250852288002289420820003E084210F8000E208208380010208104080038208208E00008522000000000000000F800102040000000007027A2780820838924E0000072082270008208E492380000722FA070000C41C4104000007A278270002082CCA288000801820870000400C114200020828C28900018208208700000D2AAAAA80000B328A28800007228A2700000E2493882000039248E082000B328208000007A0702F0000870820A1000008A28A66800008A28942000008AAAAA500000894214880000894210800000F84210F80188210208180008208208200C08204208C0000001AB0000003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80".."03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80".."03E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F8003E8A28A2F80" | |
| 195 | FONT_CUSTOM_A = {}
| |
| 196 | ||
| 197 | ChatBubble.THEME = {}
| |
| 198 | ChatBubble.THEME.COOL = {
| |
| 199 | Name = "Cool", | |
| 200 | Background = Color3.new(0, 3 / 2, 0.2), | |
| 201 | Foreground = Color3.new(2 / 3, 1, 1) | |
| 202 | } | |
| 203 | ChatBubble.THEME.AQUA = {
| |
| 204 | Name = "Aqua", | |
| 205 | Background = Color3.new(0, 1 / 3, 0.5), | |
| 206 | Foreground = Color3.new(2 / 3, 1, 1) | |
| 207 | } | |
| 208 | ChatBubble.THEME.CLASSIC = {
| |
| 209 | Name = "Classic", | |
| 210 | Background = Color3.new(0, 0, 0), | |
| 211 | Foreground = Color3.new(1, 1, 1) | |
| 212 | } | |
| 213 | ||
| 214 | ChatBubble.THEME.KAYAVEN = {
| |
| 215 | Name = "Kayaven", | |
| 216 | Background = Color3.new(0, 0, 0), | |
| 217 | Foreground = Color3.new(0, 1, 0) | |
| 218 | } | |
| 219 | ChatBubble.THEME.CRIMSON = {
| |
| 220 | Name = "Crimson", | |
| 221 | Background = Color3.new(0, 0, 0), | |
| 222 | Foreground = Color3.new(0.9, 0, 0) | |
| 223 | } | |
| 224 | ChatBubble.THEME.WHITE = {
| |
| 225 | Name = "White", | |
| 226 | Background = Color3.new(1, 1, 1), | |
| 227 | Foreground = Color3.new(1, 1, 1) | |
| 228 | } | |
| 229 | ChatBubble.THEME.GRAPE = {
| |
| 230 | Name = "Grape", | |
| 231 | Background = Color3.new(0.25, 0, 0.25), | |
| 232 | Foreground = Color3.new(1, 2 / 3, 1) | |
| 233 | } | |
| 234 | ChatBubble.THEME.LIBERATION = {
| |
| 235 | Name = "Liberation", | |
| 236 | Background = Color3.new(1 / 6, 3 / 7, 3 / 7), | |
| 237 | Foreground = Color3.new(1, 1, 1) | |
| 238 | } | |
| 239 | ChatBubble.THEME.PASSION = {
| |
| 240 | Name = "Passion", | |
| 241 | Background = Color3.new(0.5, 0, 0), | |
| 242 | Foreground = Color3.new(1, 1, 1) | |
| 243 | } | |
| 244 | ChatBubble.THEME.PURPLE = {
| |
| 245 | Name = "Purple", | |
| 246 | Background = Color3.new(0.25, 0, 0.25), | |
| 247 | Foreground = Color3.new(1, 1, 1) | |
| 248 | } | |
| 249 | ChatBubble.THEME.Black = {
| |
| 250 | Name = "Black", | |
| 251 | Background = Color3.new(0, 0, 0), | |
| 252 | Foreground = Color3.new(1, 1, 1) | |
| 253 | ||
| 254 | } | |
| 255 | ChatBubble.THEME.RAINBOW = {
| |
| 256 | Name = "Rainbow", | |
| 257 | Background = function(bubble_info) | |
| 258 | local billboard, frame = bubble_info[5], bubble_info[6] | |
| 259 | TaskScheduler.Start(function() | |
| 260 | while billboard:IsDescendantOf(Workspace) do | |
| 261 | local red, green, blue = Utility.GetRainbowRGB(tick()) | |
| 262 | frame.BackgroundColor3 = Color3.new(0.6 * red, 0.6 * green, 0.65 * blue) | |
| 263 | RunService.Stepped:wait() | |
| 264 | end | |
| 265 | end) | |
| 266 | end, | |
| 267 | Foreground = Color3.new(1, 1, 1) | |
| 268 | } | |
| 269 | ChatBubble.THEME.TEAL = {
| |
| 270 | Name = "Teal", | |
| 271 | Background = Color3.new(0, 1 / 3, 0.5), | |
| 272 | Foreground = Color3.new(1, 1, 1) | |
| 273 | } | |
| 274 | ||
| 275 | function ChatBubble.GetTheme() | |
| 276 | return ChatBubble.theme_info | |
| 277 | end | |
| 278 | function ChatBubble.SetTheme(theme_info) | |
| 279 | if type(theme_info) == "string" then | |
| 280 | theme_info = string.lower(theme_info) | |
| 281 | for key, info in pairs(ChatBubble.THEME) do | |
| 282 | if info.Name:lower() == theme_info:lower() then | |
| 283 | ChatBubble.SetTheme(info) | |
| 284 | break | |
| 285 | end | |
| 286 | end | |
| 287 | return | |
| 288 | end | |
| 289 | ChatBubble.theme_info = theme_info | |
| 290 | ChatBubble.background_color = theme_info.Background | |
| 291 | ChatBubble.font = LoadFont(ChatBubble.FONT_DEFAULT, theme_info.Foreground) | |
| 292 | print("Theme has been set to "..theme_info.Name.." in ChatBubble")
| |
| 293 | end | |
| 294 | ||
| 295 | do | |
| 296 | local floor = math.floor | |
| 297 | local max = math.max | |
| 298 | local asc = string.byte | |
| 299 | local chr = string.char | |
| 300 | local find = string.find | |
| 301 | local gmatch = string.gmatch | |
| 302 | local sub = string.sub | |
| 303 | local insert = table.insert | |
| 304 | local type = type | |
| 305 | local unpack = unpack | |
| 306 | ||
| 307 | local PopIntegerBit | |
| 308 | ||
| 309 | TextAlignment = setmetatable({
| |
| 310 | [0] = 0, | |
| 311 | [1] = 1, | |
| 312 | [2] = 2, | |
| 313 | Left = 0, | |
| 314 | Center = 1, | |
| 315 | Right = 2 | |
| 316 | }, {
| |
| 317 | __call = function(self, ...) | |
| 318 | local argc = #{...}
| |
| 319 | if argc == 0 then | |
| 320 | return 0 | |
| 321 | else | |
| 322 | local arg = (...) | |
| 323 | local value = rawget(self, arg) | |
| 324 | if value then | |
| 325 | return value | |
| 326 | else | |
| 327 | local arg_type = type(arg) | |
| 328 | error("Invalid value" .. ((arg_type == "number") and (" " .. arg) or ((arg_type == "string") and (" \"" .. arg .. "\"") or
| |
| 329 | ||
| 330 | "")) .. " for enum TextAlignment") | |
| 331 | end | |
| 332 | end | |
| 333 | end | |
| 334 | }) | |
| 335 | ||
| 336 | function PopIntegerBit(value, bit) | |
| 337 | if value >= bit then | |
| 338 | return 1, value - bit | |
| 339 | else | |
| 340 | return 0, value | |
| 341 | end | |
| 342 | end | |
| 343 | function MusicList() | |
| 344 | ||
| 345 | end | |
| 346 | function LoadFixedFont(dest, src, height, width) | |
| 347 | local n = #src / 64 - 1 | |
| 348 | local bit_index = 0 | |
| 349 | local symbol_bits = width * height | |
| 350 | for i = 0, 255 do | |
| 351 | local char_data = {}
| |
| 352 | for j = 1, height do | |
| 353 | char_data[j] = {}
| |
| 354 | end | |
| 355 | dest[i] = char_data | |
| 356 | end | |
| 357 | for i = 1, #src do | |
| 358 | local buffer = tonumber(sub(src, i, i), 16) | |
| 359 | for j = 1, 4 do | |
| 360 | local code = floor(bit_index / symbol_bits) | |
| 361 | local row = floor(bit_index / width) % height + 1 | |
| 362 | local column = bit_index % width + 1 | |
| 363 | dest[code][row][column], buffer = PopIntegerBit(buffer, 8) | |
| 364 | buffer = buffer * 2 | |
| 365 | bit_index = bit_index + 1 | |
| 366 | end | |
| 367 | end | |
| 368 | end | |
| 369 | function LoadFont(font_data, color) | |
| 370 | local font_obj = {}
| |
| 371 | for character, char_data in pairs(font_data) do | |
| 372 | local code = character | |
| 373 | if type(code) ~= "number" then | |
| 374 | code = asc(character) | |
| 375 | end | |
| 376 | local height = #char_data | |
| 377 | local width = #char_data[1] | |
| 378 | local pixel_h = 1 / height | |
| 379 | local pixel_w = 1 / width | |
| 380 | local pixel_size = UDim2.new(pixel_w, 0, pixel_h, 0) | |
| 381 | local frame = Instance.new("Frame")
| |
| 382 | frame.BackgroundTransparency = 1 | |
| 383 | frame.Name = "" | |
| 384 | for y = 1, height do | |
| 385 | local row = char_data[y] | |
| 386 | for x = 1, width do | |
| 387 | local opacity = row[x] | |
| 388 | if opacity ~= 0 then | |
| 389 | local pixel = Instance.new("Frame", frame)
| |
| 390 | pixel.BackgroundColor3 = color | |
| 391 | pixel.BorderSizePixel = 0 | |
| 392 | pixel.Name = "" | |
| 393 | pixel.Position = UDim2.new(x * pixel_w, 0, y * pixel_h, 0) - pixel_size | |
| 394 | pixel.Size = pixel_size -- + UDim2.new(0, 0, 0, 1) -- correction | |
| 395 | -- ^ never mind that correction, fixed by changing font size to 12x16 instead of 13x17 | |
| 396 | if opacity then | |
| 397 | pixel.BackgroundTransparency = 1 - opacity | |
| 398 | end | |
| 399 | end | |
| 400 | end | |
| 401 | end | |
| 402 | font_obj[code] = {frame, height, width}
| |
| 403 | end | |
| 404 | return font_obj | |
| 405 | end | |
| 406 | function DrawTextNetwork(text, font, size, delay_offset) | |
| 407 | if #text == 0 then | |
| 408 | text = " " | |
| 409 | end | |
| 410 | local frame = Instance.new("Frame")
| |
| 411 | frame.BackgroundTransparency = 1 | |
| 412 | frame.BorderSizePixel = 0 | |
| 413 | local objects = {}
| |
| 414 | local length = #text | |
| 415 | local height = 0 | |
| 416 | local width = 0 | |
| 417 | for i = 1, length do | |
| 418 | local character = sub(text, i, i) | |
| 419 | local code = asc(character) | |
| 420 | local char_data = assert(font[code] or FONT_SYMBOL_MISSING, "FONT ERROR: '" .. character .. "' (" .. code .. ") not found")
| |
| 421 | local char_proto, char_h, char_w = unpack(char_data) | |
| 422 | objects[i] = char_data | |
| 423 | height = max(char_h, height) | |
| 424 | width = width + char_w | |
| 425 | end | |
| 426 | local offset = 0 | |
| 427 | local punctuation_delay = 0 | |
| 428 | for i = 1, length do | |
| 429 | delay(delay_offset + (i + punctuation_delay - 1) / 30, function() | |
| 430 | local char_data = objects[i] | |
| 431 | local char_proto, char_h, char_w = unpack(char_data) | |
| 432 | local char_obj = char_proto:Clone() | |
| 433 | char_obj.Position = UDim2.new(offset / width, 0, 0, 0) | |
| 434 | char_obj.Size = UDim2.new(char_w / width, 0, 1, 0) | |
| 435 | char_obj.Parent = frame | |
| 436 | offset = offset + char_w | |
| 437 | end) | |
| 438 | local character = sub(text, i, i) | |
| 439 | if character == "." then | |
| 440 | punctionation_delay = punctuation_delay + 3 | |
| 441 | elseif character == "?" or character == "!" then | |
| 442 | punctionation_delay = punctuation_delay + 2 | |
| 443 | elseif character == ";" or character == "~" then | |
| 444 | punctionation_delay = punctuation_delay + 1 | |
| 445 | end | |
| 446 | end | |
| 447 | local ratio = (height == 0) and (0) or (width / height) | |
| 448 | frame.Size = UDim2.new(size.X.Scale * ratio, size.X.Offset * ratio, size.Y.Scale, size.Y.Offset) | |
| 449 | return frame, height, width, (length + punctuation_delay) / 30 | |
| 450 | end | |
| 451 | function DrawMultilineTextNetwork(text, font, size, delay_offset, ...) | |
| 452 | local align = TextAlignment(...) | |
| 453 | local frame = Instance.new("Frame")
| |
| 454 | frame.BackgroundTransparency = 1 | |
| 455 | frame.BorderSizePixel = 0 | |
| 456 | local height = 0 | |
| 457 | local width = 0 | |
| 458 | local objects = {}
| |
| 459 | for line in gmatch(text .. "\n", "([^\n]*)\n") do | |
| 460 | local line_obj, line_h, line_w, line_delay = DrawTextNetwork(line, font, size, delay_offset) | |
| 461 | insert(objects, {line_obj, line_h, line_w})
| |
| 462 | height = height + line_h | |
| 463 | width = max(line_w, width) | |
| 464 | delay_offset = delay_offset + line_delay | |
| 465 | end | |
| 466 | local offset = 0 | |
| 467 | for index, line_data in ipairs(objects) do | |
| 468 | local line_obj, line_h, line_w = unpack(line_data) | |
| 469 | local align_offset | |
| 470 | if align == TextAlignment.Left then | |
| 471 | align_offset = 0 | |
| 472 | elseif align == TextAlignment.Center then | |
| 473 | align_offset = 0.5 - line_w / width / 2 | |
| 474 | elseif align == TextAlignment.Right then | |
| 475 | align_offset = 1 - line_w / width | |
| 476 | end | |
| 477 | line_obj.Position = UDim2.new(align_offset, 0, offset / height, 0) | |
| 478 | line_obj.Parent = frame | |
| 479 | offset = offset + line_h | |
| 480 | end | |
| 481 | local line_count = #objects | |
| 482 | local ratio = (height == 0) and (0) or (line_count * width / height) | |
| 483 | frame.Size = UDim2.new(size.X.Scale * ratio, size.X.Offset * ratio, size.Y.Scale * line_count, size.Y.Offset * line_count) | |
| 484 | return frame, height, width | |
| 485 | end | |
| 486 | end | |
| 487 | ||
| 488 | LoadFixedFont(FONT_CUSTOM_A, FONT_CUSTOM_A_SRC, 8, 6) | |
| 489 | ChatBubble.FONT_DEFAULT = FONT_CUSTOM_A | |
| 490 | ChatBubble.SetTheme("Rainbow")
| |
| 491 | ||
| 492 | chat_bubbles = {}
| |
| 493 | ||
| 494 | function CreateChatBubble(bubble_info) | |
| 495 | local creation_time, text, backup = bubble_info[1], bubble_info[2], bubble_info[8] | |
| 496 | local billboard, frame, label | |
| 497 | if backup and false then | |
| 498 | billboard = backup:Clone() | |
| 499 | frame = billboard.Frame | |
| 500 | label = frame.Label | |
| 501 | bubble_info[5] = billboard | |
| 502 | bubble_info[6] = frame | |
| 503 | bubble_info[7] = label | |
| 504 | billboard.Parent = Workspace | |
| 505 | else | |
| 506 | label = DrawMultilineTextNetwork(text, bubble_info[9], UDim2.new(0, 12, 0, 16), creation_time - time(), "Center") | |
| 507 | label.Name = "Label" | |
| 508 | label.Position = UDim2.new(0, 16, 0, 16) | |
| 509 | billboard = Instance.new("BillboardGui", Workspace)
| |
| 510 | billboard.Adornee = chatAdornee | |
| 511 | billboard.AlwaysOnTop = true | |
| 512 | billboard.Size = UDim2.new(label.Size.X.Scale, label.Size.X.Offset + 32, label.Size.Y.Scale, label.Size.Y.Offset + 32) | |
| 513 | billboard.SizeOffset = Vector2.new(0, 0) | |
| 514 | billboard.StudsOffset = Vector3.new(0, 1, 0) | |
| 515 | frame = Instance.new("Frame", billboard)
| |
| 516 | bubble_info[5] = billboard | |
| 517 | bubble_info[6] = frame | |
| 518 | bubble_info[7] = label | |
| 519 | local background_color = bubble_info[10] | |
| 520 | if type(background_color) == "function" then | |
| 521 | background_color(bubble_info) | |
| 522 | else | |
| 523 | frame.BackgroundColor3 = background_color | |
| 524 | end | |
| 525 | frame.BackgroundTransparency = 0.3 | |
| 526 | frame.BorderSizePixel = 0 | |
| 527 | frame.ClipsDescendants = true | |
| 528 | frame.Name = "Frame" | |
| 529 | frame.Size = UDim2.new(1, 0, 0, 0) | |
| 530 | label.Parent = frame | |
| 531 | -- bubble_info[8] = billboard:Clone() | |
| 532 | end | |
| 533 | end | |
| 534 | local tween_time = 0.3 | |
| 535 | function ConfigureChatBubble(bubble_info) | |
| 536 | local creation_time, destruction_time, billboard, frame = bubble_info[1], bubble_info[3], bubble_info[5], bubble_info[6] | |
| 537 | if not billboard or billboard.Parent ~= workspace then | |
| 538 | CreateChatBubble(bubble_info) | |
| 539 | billboard, frame = bubble_info[5], bubble_info[6] | |
| 540 | end | |
| 541 | if billboard.Adornee ~= chatAdornee then | |
| 542 | billboard.Adornee = chatAdornee | |
| 543 | end | |
| 544 | local current_time = time() | |
| 545 | local elapsed_time = current_time - creation_time | |
| 546 | local remaining_time = destruction_time - current_time | |
| 547 | if remaining_time < 0 then | |
| 548 | bubble_info[4] = false | |
| 549 | billboard:Destroy() | |
| 550 | return false | |
| 551 | elseif remaining_time < tween_time then | |
| 552 | local tween_progress = math.sin(remaining_time * math.pi / (tween_time * 2)) | |
| 553 | frame.Size = UDim2.new(1, 0, tween_progress, 0) | |
| 554 | elseif elapsed_time < tween_time then | |
| 555 | local tween_progress = math.sin(elapsed_time * math.pi / (tween_time * 2)) | |
| 556 | frame.Size = UDim2.new(1, 0, tween_progress, 0) | |
| 557 | elseif frame.Size ~= UDim2.new(1, 0, 1, 0) then | |
| 558 | frame.Size = UDim2.new(1, 0, 1, 0) | |
| 559 | end | |
| 560 | return true | |
| 561 | end | |
| 562 | function ChatBubble.MainLoop() | |
| 563 | local offset = 0 | |
| 564 | local removing = {}
| |
| 565 | for index, bubble_info in ipairs(chat_bubbles) do | |
| 566 | if not ConfigureChatBubble(bubble_info) then | |
| 567 | removing[#removing + 1] = index - #removing | |
| 568 | else | |
| 569 | local billboard, frame = bubble_info[5], bubble_info[6] | |
| 570 | local billboard_h = billboard.Size.Y.Offset | |
| 571 | local bubble_h = frame.Size.Y.Scale * billboard_h | |
| 572 | offset = 8 + offset + bubble_h | |
| 573 | billboard.SizeOffset = Vector2.new(0, offset / billboard_h - 0.5) | |
| 574 | end | |
| 575 | end | |
| 576 | for index, bubble_index in ipairs(removing) do | |
| 577 | table.remove(chat_bubbles, bubble_index) | |
| 578 | end | |
| 579 | RunService.Stepped:wait() | |
| 580 | end | |
| 581 | function WrapText(text, character_limit, line_length_limit) | |
| 582 | if #text > character_limit then | |
| 583 | text = string.sub(text, 1, character_limit - 3) .. "..." | |
| 584 | end | |
| 585 | local text_length = #text | |
| 586 | local line_length = 0 | |
| 587 | local i = 0 | |
| 588 | while i <= text_length do | |
| 589 | i = i + 1 | |
| 590 | local character = string.sub(text, i, i) | |
| 591 | if character == "\t" then | |
| 592 | local tabulation_size = 4 - line_length % 4 | |
| 593 | line_length = line_length + tabulation_size | |
| 594 | if line_length >= line_length_limit then | |
| 595 | tabulation_size = line_length - line_length_limit | |
| 596 | line_length = 0 | |
| 597 | text_length = text_length + tabulation_size | |
| 598 | text = string.sub(text, 1, i - 1) .. string.rep(" ", tabulation_size) .. "\n" .. string.sub(text, i + 1)
| |
| 599 | i = i + tabulation_size + 1 | |
| 600 | else | |
| 601 | text_length = text_length + tabulation_size - 1 | |
| 602 | text = string.sub(text, 1, i - 1) .. string.rep(" ", tabulation_size) .. string.sub(text, i + 1)
| |
| 603 | i = i + tabulation_size - 1 | |
| 604 | end | |
| 605 | elseif character == "\n" then | |
| 606 | line_length = 0 | |
| 607 | else | |
| 608 | line_length = line_length + 1 | |
| 609 | if line_length >= line_length_limit then | |
| 610 | local k = i - line_length + 1 | |
| 611 | local success = false | |
| 612 | for j = i, k, -1 do | |
| 613 | if string.match(string.sub(text, j, j), "[ \t]") then | |
| 614 | text = string.sub(text, 1, j - 1) .. "\n" .. string.sub(text, j + 1) | |
| 615 | text_length = text_length + 1 | |
| 616 | success = true | |
| 617 | break | |
| 618 | end | |
| 619 | end | |
| 620 | if not success then | |
| 621 | text = string.sub(text, 1, i) .. "\n" .. string.sub(text, i + 1) | |
| 622 | text_length = text_length + 1 | |
| 623 | end | |
| 624 | i = i + 1 | |
| 625 | line_length = 0 | |
| 626 | end | |
| 627 | end | |
| 628 | end | |
| 629 | if #text > character_limit then | |
| 630 | text = string.sub(text, 1, character_limit - 3) .. "..." | |
| 631 | end | |
| 632 | return text | |
| 633 | end | |
| 634 | function ChatBubble.Create(text, theme) | |
| 635 | local text = WrapText(text, 200, 30) | |
| 636 | local creation_time = time() | |
| 637 | local bubble_info = {creation_time, text, creation_time + 6 + #text / 15, true}
| |
| 638 | local previousTheme | |
| 639 | if theme then | |
| 640 | previousTheme = ChatBubble.GetTheme() | |
| 641 | ChatBubble.SetTheme(theme) | |
| 642 | end | |
| 643 | bubble_info[9] = ChatBubble.font | |
| 644 | bubble_info[10] = ChatBubble.background_color | |
| 645 | if previousTheme then | |
| 646 | ChatBubble.SetTheme(previousTheme) | |
| 647 | end | |
| 648 | table.insert(chat_bubbles, 1, bubble_info) | |
| 649 | end | |
| 650 | TaskScheduler.Start(function() | |
| 651 | while true do | |
| 652 | ChatBubble.MainLoop() | |
| 653 | end | |
| 654 | end) | |
| 655 | ||
| 656 | PyramidCharacter = {};
| |
| 657 | ||
| 658 | local stock_triangle = Instance.new("WedgePart")
| |
| 659 | stock_triangle.Anchored = true | |
| 660 | stock_triangle.BottomSurface = "Smooth" | |
| 661 | stock_triangle.FormFactor = "Custom" | |
| 662 | stock_triangle.Locked = true | |
| 663 | stock_triangle.TopSurface = "Smooth" | |
| 664 | local stock_triangle_mesh = Instance.new("SpecialMesh", stock_triangle)
| |
| 665 | stock_triangle_mesh.MeshType = "Wedge" | |
| 666 | local triangles = {}
| |
| 667 | function PyramidCharacter.CreateTriangle(v1, v2, v3, properties, parent, index) | |
| 668 | local triangleInfo = triangles[index] | |
| 669 | local side1 = (v1 - v2).magnitude | |
| 670 | local side2 = (v2 - v3).magnitude | |
| 671 | local side3 = (v3 - v1).magnitude | |
| 672 | local sqrside1 = side1 * side1 | |
| 673 | local sqrside2 = side2 * side2 | |
| 674 | local sqrside3 = side3 * side3 | |
| 675 | if sqrside3 + sqrside1 == sqrside2 then | |
| 676 | v1, v2, v3 = v1, v2, v3 | |
| 677 | elseif sqrside1 + sqrside2 == sqrside3 then | |
| 678 | v1, v2, v3 = v2, v3, v1 | |
| 679 | elseif sqrside2 + sqrside3 == sqrside1 then | |
| 680 | v1, v2, v3 = v3, v1, v2 | |
| 681 | elseif sqrside1 >= sqrside2 and sqrside1 >= sqrside3 then | |
| 682 | v1, v2, v3 = v1, v2, v3 | |
| 683 | elseif sqrside2 >= sqrside3 and sqrside2 >= sqrside1 then | |
| 684 | v1, v2, v3 = v2, v3, v1 | |
| 685 | else | |
| 686 | v1, v2, v3 = v3, v1, v2 | |
| 687 | end | |
| 688 | local model, part1, part2, mesh1, mesh2 | |
| 689 | if triangleInfo then | |
| 690 | model, part1, part2, mesh1, mesh2 = unpack(triangleInfo) | |
| 691 | if not (model.Parent == parent and part1.Parent == model and part2.Parent == model and mesh1.Parent == part1 and mesh2.Parent == part2) then | |
| 692 | if model.Parent then | |
| 693 | model:Destroy() | |
| 694 | end | |
| 695 | model = nil | |
| 696 | end | |
| 697 | else | |
| 698 | triangleInfo = {}
| |
| 699 | triangles[index] = triangleInfo | |
| 700 | end | |
| 701 | if not model then | |
| 702 | model = Instance.new("Model")
| |
| 703 | part1 = stock_triangle:Clone() | |
| 704 | part2 = stock_triangle:Clone() | |
| 705 | mesh1 = part1.Mesh | |
| 706 | mesh2 = part2.Mesh | |
| 707 | part1.Parent = model | |
| 708 | part2.Parent = model | |
| 709 | triangleInfo[1] = model | |
| 710 | triangleInfo[2] = part1 | |
| 711 | triangleInfo[3] = part2 | |
| 712 | triangleInfo[4] = mesh1 | |
| 713 | triangleInfo[5] = mesh2 | |
| 714 | end | |
| 715 | for key, value in pairs(properties) do | |
| 716 | part1[key] = value | |
| 717 | part2[key] = value | |
| 718 | end | |
| 719 | local cframe = CFrame.new(v1, v2) | |
| 720 | local relpos = cframe:pointToObjectSpace(v3) | |
| 721 | cframe = cframe * CFrame.fromEulerAnglesXYZ(0, 0, -math.atan2(relpos.x, relpos.y)) | |
| 722 | local rel1 = cframe:pointToObjectSpace(v1) | |
| 723 | local rel2 = cframe:pointToObjectSpace(v2) | |
| 724 | local rel3 = cframe:pointToObjectSpace(v3) | |
| 725 | local height = rel3.y | |
| 726 | local width1 = rel3.z | |
| 727 | local width2 = rel2.z - rel3.z | |
| 728 | local relcenter1 = Vector3.new(0, height / 2, width1 / 2) | |
| 729 | local center1 = cframe:pointToWorldSpace(relcenter1) | |
| 730 | local relcenter2 = Vector3.new(0, height / 2, width2 / 2 + width1) | |
| 731 | local center2 = cframe:pointToWorldSpace(relcenter2) | |
| 732 | height = math.abs(height) | |
| 733 | width1 = math.abs(width1) | |
| 734 | width2 = math.abs(width2) | |
| 735 | if not part1.Anchored then | |
| 736 | part1.Anchored = true | |
| 737 | end | |
| 738 | part1.Size = Vector3.new(0.2, height, width1) | |
| 739 | part1.CFrame = cframe * CFrame.fromEulerAnglesXYZ(0, math.pi, 0) - cframe.p + center1 | |
| 740 | mesh1.Scale = Vector3.new(0, height / part1.Size.y, width1 / part1.Size.z) | |
| 741 | if not part2.Anchored then | |
| 742 | part2.Anchored = true | |
| 743 | end | |
| 744 | part2.Size = Vector3.new(0.2, height, width1) | |
| 745 | part2.CFrame = cframe - cframe.p + center2 | |
| 746 | mesh2.Scale = Vector3.new(0, height / part1.Size.y, width2 / part2.Size.z) | |
| 747 | model.Parent = parent | |
| 748 | return model | |
| 749 | end | |
| 750 | PyramidCharacter.head_properties = {BrickColor = BrickColor.new(Color3.new(1, 1, 1)), Transparency = 0.5}
| |
| 751 | PyramidCharacter.head_radius = math.pi | |
| 752 | PyramidCharacter.center = CFrame.new(0, 10, 0) | |
| 753 | PyramidCharacter.point1 = Vector3.new() | |
| 754 | PyramidCharacter.point2 = Vector3.new() | |
| 755 | PyramidCharacter.point3 = Vector3.new() | |
| 756 | PyramidCharacter.point4 = Vector3.new() | |
| 757 | PyramidCharacter.core_mesh_scale = Vector3.new(0.833, 0.833, 0.833) | |
| 758 | PyramidCharacter.visible = false | |
| 759 | function PyramidCharacter.Teleport(location) | |
| 760 | PyramidCharacter.point1 = location | |
| 761 | PyramidCharacter.point2 = location | |
| 762 | PyramidCharacter.point3 = location | |
| 763 | PyramidCharacter.point4 = location | |
| 764 | end | |
| 765 | local stock_core = Instance.new("Part")
| |
| 766 | stock_core.Anchored = true | |
| 767 | stock_core.BottomSurface = "Smooth" | |
| 768 | stock_core.Color = Color3.new(1, 1, 1) | |
| 769 | stock_core.FormFactor = "Custom" | |
| 770 | stock_core.Locked = true | |
| 771 | stock_core.Name = "CubePyramid" | |
| 772 | stock_core.Size = Vector3.new(0.5, 0.5, 0.5) | |
| 773 | stock_core.TopSurface = "Smooth" | |
| 774 | PyramidCharacter.stock_core = stock_core | |
| 775 | PyramidCharacter.core = stock_core:Clone() | |
| 776 | PyramidCharacter.Archivable = false | |
| 777 | PyramidCharacter.core_mesh = Instance.new("BlockMesh", core)
| |
| 778 | PyramidCharacter.core_lights = {}
| |
| 779 | PyramidCharacter.coreLightCount = 1 | |
| 780 | for index = 1, PyramidCharacter.coreLightCount do | |
| 781 | PyramidCharacter.core_lights[index] = Instance.new("PointLight", core)
| |
| 782 | end | |
| 783 | PyramidCharacter.camera_distance = (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude | |
| 784 | PyramidCharacter.camera_position = Vector3.new() | |
| 785 | Camera.Changed:connect(function(property) | |
| 786 | if PyramidCharacter.visible then | |
| 787 | if property == "CoordinateFrame" then | |
| 788 | local cframe, focus = Camera.CoordinateFrame, Camera.Focus | |
| 789 | local eventTime = time() | |
| 790 | local connection | |
| 791 | connection = Camera.Changed:connect(function() | |
| 792 | connection:disconnect() | |
| 793 | if eventTime == time() and Camera.Focus ~= focus then | |
| 794 | local camera_distance = PyramidCharacter.camera_distance | |
| 795 | Camera.Focus = Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance) | |
| 796 | PyramidCharacter.camera_position = (Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)).p | |
| 797 | end | |
| 798 | end) | |
| 799 | coroutine.yield() | |
| 800 | if Camera.Focus == focus then | |
| 801 | PyramidCharacter.camera_distance = (focus.p - cframe.p).magnitude | |
| 802 | else | |
| 803 | local camera_distance = PyramidCharacter.camera_distance | |
| 804 | Camera.Focus = Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance) | |
| 805 | PyramidCharacter.camera_position = (Camera.CoordinateFrame * CFrame.new(0, 0, -camera_distance)).p | |
| 806 | end | |
| 807 | if connection.connected then | |
| 808 | connection:disconnect() | |
| 809 | end | |
| 810 | end | |
| 811 | end | |
| 812 | end) | |
| 813 | function PyramidCharacter.Animate() | |
| 814 | local total_time = time() | |
| 815 | local core = PyramidCharacter.core | |
| 816 | local frame = PyramidCharacter.frame | |
| 817 | if PyramidCharacter.visible then | |
| 818 | local core_mesh = PyramidCharacter.core_mesh | |
| 819 | local core_lights = PyramidCharacter.core_lights | |
| 820 | if not frame or frame.Parent ~= core then | |
| 821 | frame = Instance.new("Model")
| |
| 822 | frame.Archivable = false | |
| 823 | frame.Parent = core | |
| 824 | PyramidCharacter.frame = frame | |
| 825 | end | |
| 826 | if core.Parent ~= Workspace then | |
| 827 | core = PyramidCharacter.stock_core:Clone() | |
| 828 | PyramidCharacter.core = core | |
| 829 | core.Archivable = false | |
| 830 | core.Parent = Workspace | |
| 831 | chatAdornee = core | |
| 832 | end | |
| 833 | if core_mesh.Parent ~= core then | |
| 834 | core_mesh = Instance.new("BlockMesh", core)
| |
| 835 | PyramidCharacter.core_mesh = core_mesh | |
| 836 | end | |
| 837 | for index, core_light in ipairs(core_lights) do | |
| 838 | if core_light.Parent ~= core then | |
| 839 | core_light = Instance.new("PointLight", core)
| |
| 840 | core_lights[index] = core_light | |
| 841 | end | |
| 842 | local vertexColor = Vector3.new(Utility.GetRainbowRGB(total_time)) * 0.25 + Vector3.new(1, 1, 1) * 0.75 | |
| 843 | core_light.Color = Color3.new(vertexColor.X, vertexColor.Y, vertexColor.Z) | |
| 844 | core_light.Brightness = 0.85 + 0.15 * math.random() | |
| 845 | if core_light.Range ~= 30 then | |
| 846 | core_light.Range = 30 | |
| 847 | end | |
| 848 | if not core_light.Shadows then | |
| 849 | core_light.Shadows = true | |
| 850 | end | |
| 851 | end | |
| 852 | if core_mesh.Offset ~= Vector3.new(0, 0, 0) then | |
| 853 | core_mesh.Offset = Vector3.new(0, 0, 0) | |
| 854 | end | |
| 855 | if not core.Anchored then | |
| 856 | core.Anchored = true | |
| 857 | end | |
| 858 | if core.Transparency ~= 0 then | |
| 859 | core.Transparency = 0 | |
| 860 | end | |
| 861 | local core_mesh_scale = PyramidCharacter.core_mesh_scale | |
| 862 | local transition_speed = (math.sin(total_time * math.tau) + 1) / 16 | |
| 863 | core_mesh_scale = core_mesh_scale * (1 - transition_speed) + Vector3.new(math.random() * 0.5 + 0.5, math.random() * 0.5 + 0.5, math.random() | |
| 864 | ||
| 865 | * 0.5 + 0.5) * transition_speed | |
| 866 | core_mesh.Scale = core_mesh_scale * 2 | |
| 867 | local center = CFrame.new(PyramidCharacter.camera_position) * CFrame.Angles(0, total_time * math.tau, 0) | |
| 868 | local cframe1 = CFrame.new(PyramidCharacter.head_radius, 0, 0) | |
| 869 | local cframe2 = CFrame.Angles(math.tau / -3, 0, 0) | |
| 870 | local cframe3 = CFrame.Angles(0, math.tau / 3, 0) | |
| 871 | local cframe4 = center * cframe3 | |
| 872 | local desired1 = center * CFrame.new(0, PyramidCharacter.head_radius, 0) | |
| 873 | local desired2 = center * cframe2 * cframe1 | |
| 874 | local desired3 = cframe4 * cframe2 * cframe1 | |
| 875 | local desired4 = cframe4 * cframe3 * cframe2 * cframe1 | |
| 876 | local point1 = (PyramidCharacter.point1 * 3 + desired1.p) / 4 | |
| 877 | local point2 = (PyramidCharacter.point2 * 3 + desired2.p) / 4 | |
| 878 | local point3 = (PyramidCharacter.point3 * 3 + desired3.p) / 4 | |
| 879 | local point4 = (PyramidCharacter.point4 * 3 + desired4.p) / 4 | |
| 880 | PyramidCharacter.point1 = point1 | |
| 881 | PyramidCharacter.point2 = point2 | |
| 882 | PyramidCharacter.point3 = point3 | |
| 883 | PyramidCharacter.point4 = point4 | |
| 884 | local head_properties = PyramidCharacter.head_properties | |
| 885 | PyramidCharacter.CreateTriangle(point1, point2, point3, head_properties, frame, 1).Archivable = false | |
| 886 | PyramidCharacter.CreateTriangle(point2, point3, point4, head_properties, frame, 2).Archivable = false | |
| 887 | PyramidCharacter.CreateTriangle(point3, point4, point1, head_properties, frame, 3).Archivable = false | |
| 888 | PyramidCharacter.CreateTriangle(point4, point1, point2, head_properties, frame, 4).Archivable = false | |
| 889 | core.CFrame = CFrame.new((point1 + point2 + point3 + point4) / 4) * CFrame.Angles(total_time * math.tau, total_time * math.tau / 2, | |
| 890 | ||
| 891 | total_time * math.tau / 3) | |
| 892 | PyramidCharacter.center = center | |
| 893 | else | |
| 894 | if core.Parent then | |
| 895 | core:Destroy() | |
| 896 | end | |
| 897 | if frame and frame.Parent then | |
| 898 | frame:Destroy() | |
| 899 | end | |
| 900 | PyramidCharacter.frame = nil | |
| 901 | end | |
| 902 | end | |
| 903 | function PyramidCharacter.MainLoop() | |
| 904 | PyramidCharacter.Animate() | |
| 905 | RunService.Stepped:wait() | |
| 906 | end | |
| 907 | TaskScheduler.Start(function() | |
| 908 | while true do | |
| 909 | PyramidCharacter.MainLoop() | |
| 910 | end | |
| 911 | end) | |
| 912 | ||
| 913 | RBXInstance = {};
| |
| 914 | ||
| 915 | RBXInstance.init_metatable = {}
| |
| 916 | function RBXInstance.init_metatable:__call(data) | |
| 917 | local instance = Instance.new(self[1]) | |
| 918 | for key, value in pairs(data) do | |
| 919 | if type(key) == "number" then | |
| 920 | value.Parent = instance | |
| 921 | else | |
| 922 | instance[key] = value | |
| 923 | end | |
| 924 | end | |
| 925 | return instance | |
| 926 | end | |
| 927 | function RBXInstance.new(className) | |
| 928 | return setmetatable({className}, RBXInstance.init_metatable)
| |
| 929 | end | |
| 930 | ||
| 931 | Utility = {};
| |
| 932 | ||
| 933 | function Utility.CleanLighting() | |
| 934 | Lighting.Ambient = Color3.new(0, 0, 0) | |
| 935 | Lighting.Brightness = 1 | |
| 936 | Lighting.ColorShift_Bottom = Color3.new(0, 0, 0) | |
| 937 | Lighting.ColorShift_Top = Color3.new(0, 0, 0) | |
| 938 | Lighting.FogColor = Color3.new(0.75294125080109, 0.75294125080109, 0.75294125080109) | |
| 939 | Lighting.FogEnd = 100000 | |
| 940 | Lighting.FogStart = 0 | |
| 941 | Lighting.GeographicLatitude = 41.733299255371095 | |
| 942 | Lighting.GlobalShadows = true | |
| 943 | Lighting.OutdoorAmbient = Color3.new(0.5, 0.5, 0.5) | |
| 944 | Lighting.Outlines = false | |
| 945 | Lighting.ShadowColor = Color3.new(0.70196080207825, 0.70196080207825, 0.72156864404678) | |
| 946 | Lighting.TimeOfDay = "14:00:00" | |
| 947 | for index, child in ipairs(Lighting:GetChildren()) do | |
| 948 | if child:IsA("Sky") then
| |
| 949 | child:Destroy() | |
| 950 | end | |
| 951 | end | |
| 952 | end | |
| 953 | ||
| 954 | function Utility.GetProperty(object, field) | |
| 955 | return object[field] | |
| 956 | end | |
| 957 | ||
| 958 | function Utility.CaseInsensitivePattern(pattern) | |
| 959 | return string.gsub(pattern, "(%%?)(.)", Utility.CaseInsensitivePatternReplaceFunc) | |
| 960 | end | |
| 961 | function Utility.CaseInsensitivePatternReplaceFunc(percent, letter) | |
| 962 | if percent ~= "" or not letter:match("%a") then
| |
| 963 | return percent .. letter | |
| 964 | else | |
| 965 | return "[" .. string.lower(letter) .. string.upper(letter) .. "]" | |
| 966 | end | |
| 967 | end | |
| 968 | function Utility.FindHumanoidClosestToRay(ray, exlusionList) | |
| 969 | local view = CFrame.new(ray.Origin, ray.Origin + ray.Direction) | |
| 970 | local inverseView = view:inverse() | |
| 971 | local objects = Workspace:GetChildren() | |
| 972 | local numObjects = #objects | |
| 973 | local minDistance = math.huge | |
| 974 | local closestHumanoid, closestTorso, closestTorsoPosition | |
| 975 | for index, object in ipairs(objects) do | |
| 976 | for index, child in ipairs(object:GetChildren()) do | |
| 977 | numObjects = numObjects + 1 | |
| 978 | objects[numObjects] = child | |
| 979 | end | |
| 980 | if object.ClassName == "Humanoid" and object.Health > 0 then | |
| 981 | local torso = object.Torso | |
| 982 | if torso and not (exlusionList and exlusionList[torso]) then | |
| 983 | local torsoPosition = torso.Position | |
| 984 | local relativePosition = inverseView * torsoPosition | |
| 985 | local distanceZ = -relativePosition.Z | |
| 986 | if distanceZ > 0 then | |
| 987 | local distance = (inverseView * torsoPosition * Vector3.new(1, 1, 0)).magnitude / distanceZ | |
| 988 | if distance < 0.25 and distance < minDistance then | |
| 989 | closestHumanoid = object | |
| 990 | closestTorso = torso | |
| 991 | closestTorsoPosition = torsoPosition | |
| 992 | minDistance = distance | |
| 993 | end | |
| 994 | end | |
| 995 | end | |
| 996 | end | |
| 997 | end | |
| 998 | return closestHumanoid, closestTorso, closestTorsoPosition, minDistance | |
| 999 | end | |
| 1000 | function Utility.FindLocalHead() | |
| 1001 | if Player then | |
| 1002 | local head, position, view | |
| 1003 | pcall(function() | |
| 1004 | position = Camera.Focus.p | |
| 1005 | view = Camera.CoordinateFrame | |
| 1006 | end) | |
| 1007 | pcall(function() | |
| 1008 | for _, child in ipairs(Workspace:GetChildren()) do | |
| 1009 | if Players:GetPlayerFromCharacter(child) == Player then | |
| 1010 | for _, child in ipairs(child:GetChildren()) do | |
| 1011 | if tostring(child) == "Head" and pcall(assert, pcall(Game.IsA, child, "BasePart")) then | |
| 1012 | head = child | |
| 1013 | break | |
| 1014 | end | |
| 1015 | end | |
| 1016 | break | |
| 1017 | end | |
| 1018 | end | |
| 1019 | if not head and view then | |
| 1020 | local min_distance = math.huge | |
| 1021 | local objects = Workspace:GetChildren() | |
| 1022 | for _, object in ipairs(objects) do | |
| 1023 | local success, is_part = pcall(Game.IsA, object, "BasePart") | |
| 1024 | if success and is_part then | |
| 1025 | pcall(function() | |
| 1026 | local distance = (view:pointToObjectSpace(object.Position) * Vector3.new(1, 1, 0)).magnitude | |
| 1027 | if distance < min_distance and distance < 1 then | |
| 1028 | min_distance = distance | |
| 1029 | head = object | |
| 1030 | elseif tostring(object) == "Head" and tostring(object.Parent):lower():match("^" .. tostring(Player):lower()) then
| |
| 1031 | min_distance = 0 | |
| 1032 | head = object | |
| 1033 | end | |
| 1034 | end) | |
| 1035 | if min_distance < 5e-4 then | |
| 1036 | break | |
| 1037 | end | |
| 1038 | end | |
| 1039 | pcall(function() | |
| 1040 | if not object:IsA("Camera") then
| |
| 1041 | for _, child in ipairs(object:GetChildren()) do | |
| 1042 | objects[#objects + 1] = child | |
| 1043 | end | |
| 1044 | end | |
| 1045 | end) | |
| 1046 | end | |
| 1047 | end | |
| 1048 | end) | |
| 1049 | return head, position, view | |
| 1050 | end | |
| 1051 | end | |
| 1052 | function Utility.GetBuildingTools() | |
| 1053 | local backpack = Player:FindFirstChild("Backpack")
| |
| 1054 | if backpack then | |
| 1055 | local moveTool = Instance.new("HopperBin")
| |
| 1056 | local cloneTool = Instance.new("HopperBin")
| |
| 1057 | local deleteTool = Instance.new("HopperBin")
| |
| 1058 | moveTool.BinType = Enum.BinType.GameTool | |
| 1059 | cloneTool.BinType = Enum.BinType.Clone | |
| 1060 | deleteTool.BinType = Enum.BinType.Hammer | |
| 1061 | moveTool.Parent = backpack | |
| 1062 | cloneTool.Parent = backpack | |
| 1063 | deleteTool.Parent = backpack | |
| 1064 | end | |
| 1065 | end | |
| 1066 | function Utility.Rejoin() | |
| 1067 | Workspace.Parent:service'TeleportService':Teleport(Game.PlaceId) | |
| 1068 | end | |
| 1069 | ||
| 1070 | function Utility.BlockRobloxFilter(text) | |
| 1071 | return string.gsub(text, ".", "%1\143") | |
| 1072 | end | |
| 1073 | ||
| 1074 | function Utility.GetTimestamp() | |
| 1075 | local unix_time = tick() | |
| 1076 | local time_secs = math.floor(unix_time % 60) | |
| 1077 | local time_mins = math.floor(unix_time / 60 % 60) | |
| 1078 | local time_hours = math.floor(unix_time / 3600 % 24) | |
| 1079 | return string.format("%02i:%02i:%02i", time_hours, time_mins, time_secs)
| |
| 1080 | end | |
| 1081 | ||
| 1082 | function Utility.GetRainbowRGB(hue) | |
| 1083 | local section = hue % 1 * 3 | |
| 1084 | local secondary = 0.5 * math.pi * (section % 1) | |
| 1085 | if section < 1 then | |
| 1086 | return 1, 1 - math.cos(secondary), 1 - math.sin(secondary) | |
| 1087 | elseif section < 2 then | |
| 1088 | return 1 - math.sin(secondary), 1, 1 - math.cos(secondary) | |
| 1089 | else | |
| 1090 | return 1 - math.cos(secondary), 1 - math.sin(secondary), 1 | |
| 1091 | end | |
| 1092 | end | |
| 1093 | ||
| 1094 | function Utility.SetProperty(object, field, value) | |
| 1095 | object[field] = value | |
| 1096 | end | |
| 1097 | ||
| 1098 | function Utility.CleanWorkspace() | |
| 1099 | for index, child in ipairs(Workspace:GetChildren()) do | |
| 1100 | if not (Players:GetPlayerFromCharacter(child) or child.ClassName == "Camera" or child:IsA("Script") or child.ClassName == "Terrain") then
| |
| 1101 | pcall(child.Destroy, child) | |
| 1102 | end | |
| 1103 | end | |
| 1104 | Workspace.Terrain:Clear() | |
| 1105 | local base = Instance.new("Part")
| |
| 1106 | base.Anchored = true | |
| 1107 | base.BrickColor = BrickColor.new("Earth green")
| |
| 1108 | base.Locked = true | |
| 1109 | base.Name = "Base" | |
| 1110 | base.Size = Vector3.new(512, 1.2, 512) | |
| 1111 | base.Parent = Workspace | |
| 1112 | end | |
| 1113 | ||
| 1114 | function Utility.CleanWorkspaceAndScripts() | |
| 1115 | for index, child in ipairs(Workspace:GetChildren()) do | |
| 1116 | if not (Players:GetPlayerFromCharacter(child) or child.ClassName == "Camera" or child.ClassName == "Terrain") then | |
| 1117 | pcall(child.Destroy, child) | |
| 1118 | end | |
| 1119 | end | |
| 1120 | Workspace.Terrain:Clear() | |
| 1121 | local base = Instance.new("Part")
| |
| 1122 | base.Anchored = true | |
| 1123 | base.BrickColor = BrickColor.new("Earth green")
| |
| 1124 | base.Locked = true | |
| 1125 | base.Name = "Base" | |
| 1126 | base.Size = Vector3.new(512, 1.2, 512) | |
| 1127 | base.Parent = Workspace | |
| 1128 | end | |
| 1129 | ||
| 1130 | function Utility.CreateDummy(cframe, name, parent) | |
| 1131 | local model = Instance.new("Model")
| |
| 1132 | model.Archivable = false | |
| 1133 | model.Name = name | |
| 1134 | local humanoid = Instance.new("Humanoid", model)
| |
| 1135 | local head = Instance.new("Part", model)
| |
| 1136 | local face = Instance.new("Decal", head)
| |
| 1137 | local head_mesh = Instance.new("SpecialMesh", head)
| |
| 1138 | local torso = Instance.new("Part", model)
| |
| 1139 | local right_arm = Instance.new("Part", model)
| |
| 1140 | local left_arm = Instance.new("Part", model)
| |
| 1141 | local right_leg = Instance.new("Part", model)
| |
| 1142 | local left_leg = Instance.new("Part", model)
| |
| 1143 | local neck = Instance.new("Motor", torso)
| |
| 1144 | local right_shoulder = Instance.new("Motor", torso)
| |
| 1145 | local left_shoulder = Instance.new("Motor", torso)
| |
| 1146 | local right_hip = Instance.new("Motor", torso)
| |
| 1147 | local left_hip = Instance.new("Motor", torso)
| |
| 1148 | head.BrickColor = BrickColor.Yellow() | |
| 1149 | head.CFrame = cframe * CFrame.new(0, 1.5, 0) | |
| 1150 | head.FormFactor = "Symmetric" | |
| 1151 | head.Locked = true | |
| 1152 | head.Name = "Head" | |
| 1153 | head.Size = Vector3.new(2, 1, 1) | |
| 1154 | head.TopSurface = "Smooth" | |
| 1155 | face.Texture = "rbxasset://textures/face.png" | |
| 1156 | head_mesh.Scale = Vector3.new(1.25, 1.25, 1.25) | |
| 1157 | torso.BrickColor = BrickColor.Blue() | |
| 1158 | torso.CFrame = cframe | |
| 1159 | torso.FormFactor = "Symmetric" | |
| 1160 | torso.LeftSurface = "Weld" | |
| 1161 | torso.Locked = true | |
| 1162 | torso.RightSurface = "Weld" | |
| 1163 | torso.Name = "Torso" | |
| 1164 | torso.Size = Vector3.new(2, 2, 1) | |
| 1165 | right_arm.BrickColor = BrickColor.Yellow() | |
| 1166 | right_arm.CanCollide = false | |
| 1167 | right_arm.CFrame = cframe * CFrame.new(1.5, 0, 0) | |
| 1168 | right_arm.FormFactor = "Symmetric" | |
| 1169 | right_arm.Locked = true | |
| 1170 | right_arm.Name = "Right Arm" | |
| 1171 | right_arm.Size = Vector3.new(1, 2, 1) | |
| 1172 | left_arm.BrickColor = BrickColor.Yellow() | |
| 1173 | left_arm.CanCollide = false | |
| 1174 | left_arm.CFrame = cframe * CFrame.new(-1.5, 0, 0) | |
| 1175 | left_arm.FormFactor = "Symmetric" | |
| 1176 | left_arm.Locked = true | |
| 1177 | left_arm.Name = "Left Arm" | |
| 1178 | left_arm.Size = Vector3.new(1, 2, 1) | |
| 1179 | right_leg.BrickColor = BrickColor.new("Br. yellowish green")
| |
| 1180 | right_leg.BottomSurface = "Smooth" | |
| 1181 | right_leg.CanCollide = false | |
| 1182 | right_leg.CFrame = cframe * CFrame.new(0.5, -2, 0) | |
| 1183 | right_leg.FormFactor = "Symmetric" | |
| 1184 | right_leg.Locked = true | |
| 1185 | right_leg.Name = "Right Leg" | |
| 1186 | right_leg.Size = Vector3.new(1, 2, 1) | |
| 1187 | right_leg.TopSurface = "Smooth" | |
| 1188 | left_leg.BrickColor = BrickColor.new("Br. yellowish green")
| |
| 1189 | left_leg.BottomSurface = "Smooth" | |
| 1190 | left_leg.CanCollide = false | |
| 1191 | left_leg.CFrame = cframe * CFrame.new(-0.5, -2, 0) | |
| 1192 | left_leg.FormFactor = "Symmetric" | |
| 1193 | left_leg.Locked = true | |
| 1194 | left_leg.Name = "Left Leg" | |
| 1195 | left_leg.Size = Vector3.new(1, 2, 1) | |
| 1196 | left_leg.TopSurface = "Smooth" | |
| 1197 | neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
| 1198 | neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
| 1199 | neck.Name = "Neck" | |
| 1200 | neck.Part0 = torso | |
| 1201 | neck.Part1 = head | |
| 1202 | right_shoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 1203 | right_shoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 1204 | right_shoulder.MaxVelocity = 0.15 | |
| 1205 | right_shoulder.Name = "Right Shoulder" | |
| 1206 | right_shoulder.Part0 = torso | |
| 1207 | right_shoulder.Part1 = right_arm | |
| 1208 | left_shoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 1209 | left_shoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 1210 | left_shoulder.MaxVelocity = 0.15 | |
| 1211 | left_shoulder.Name = "Left Shoulder" | |
| 1212 | left_shoulder.Part0 = torso | |
| 1213 | left_shoulder.Part1 = left_arm | |
| 1214 | right_hip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 1215 | right_hip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 1216 | right_hip.MaxVelocity = 0.1 | |
| 1217 | right_hip.Name = "Right Hip" | |
| 1218 | right_hip.Part0 = torso | |
| 1219 | right_hip.Part1 = right_leg | |
| 1220 | left_hip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 1221 | left_hip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 1222 | left_hip.MaxVelocity = 0.1 | |
| 1223 | left_hip.Name = "Left Hip" | |
| 1224 | left_hip.Part0 = torso | |
| 1225 | left_hip.Part1 = left_leg | |
| 1226 | humanoid.Died:connect(function() | |
| 1227 | wait(5) | |
| 1228 | model:Destroy() | |
| 1229 | end) | |
| 1230 | model.Parent = parent | |
| 1231 | return model | |
| 1232 | end | |
| 1233 | ||
| 1234 | Serializer = {};
| |
| 1235 | ||
| 1236 | Serializer.NAN = math.abs(0 / 0) | |
| 1237 | ||
| 1238 | function Serializer.DecodeFloatArray(metadata_size, lookup, data, index) | |
| 1239 | local metadata_bytes = math.ceil(metadata_size * 0.25) | |
| 1240 | local metadata = {string.byte(data, index, index + metadata_bytes - 1)}
| |
| 1241 | local components = {}
| |
| 1242 | local start_index = index | |
| 1243 | index = index + metadata_bytes | |
| 1244 | for byte_index, byte in ipairs(metadata) do | |
| 1245 | local last_offset = 3 | |
| 1246 | if byte_index == metadata_bytes then | |
| 1247 | last_offset = (metadata_size - 1) % 4 | |
| 1248 | end | |
| 1249 | for value_offset = 0, last_offset do | |
| 1250 | local value_code = byte * 0.25 ^ value_offset % 4 | |
| 1251 | value_code = value_code - value_code % 1 | |
| 1252 | if value_code == 0 then | |
| 1253 | table.insert(components, Serializer.DecodeFloat32(string.byte(data, index, index + 3))) | |
| 1254 | index = index + 4 | |
| 1255 | else | |
| 1256 | table.insert(components, lookup[value_code]) | |
| 1257 | end | |
| 1258 | end | |
| 1259 | end | |
| 1260 | return components, index - start_index | |
| 1261 | end | |
| 1262 | function Serializer.EncodeFloatArray(values, common) | |
| 1263 | local lookup = {[common[1]] = 1, [common[2]] = 2, [common[3]] = 3}
| |
| 1264 | local value_count = #values | |
| 1265 | local metadata_bytes = math.ceil(value_count * 0.25) | |
| 1266 | local metadata = {}
| |
| 1267 | local buffer = {}
| |
| 1268 | for byte_index = 1, metadata_bytes do | |
| 1269 | local last_offset = 3 | |
| 1270 | if byte_index == metadata_bytes then | |
| 1271 | last_offset = (value_count - 1) % 4 | |
| 1272 | end | |
| 1273 | local metadata_byte = 0 | |
| 1274 | local offset_multiplier = 1 | |
| 1275 | local byte_offset = (byte_index - 1) * 4 + 1 | |
| 1276 | for value_offset = 0, last_offset do | |
| 1277 | local value_index = byte_offset + value_offset | |
| 1278 | local value = values[value_index] | |
| 1279 | local code = lookup[value] or 0 | |
| 1280 | metadata_byte = metadata_byte + code * offset_multiplier | |
| 1281 | offset_multiplier = offset_multiplier * 4 | |
| 1282 | if code == 0 then | |
| 1283 | table.insert(buffer, Serializer.EncodeFloat32(value)) | |
| 1284 | end | |
| 1285 | end | |
| 1286 | metadata[byte_index] = string.char(metadata_byte) | |
| 1287 | end | |
| 1288 | return table.concat(metadata) .. table.concat(buffer) | |
| 1289 | end | |
| 1290 | ||
| 1291 | function Serializer.DecodeColor3(data, index) | |
| 1292 | local components, size = Serializer.DecodeFloatArray(3, {0, 0.5, 1}, data, index)
| |
| 1293 | return Color3.new(unpack(components)), size | |
| 1294 | end | |
| 1295 | function Serializer.DecodeFloat32(b0, b1, b2, b3) | |
| 1296 | local b2_low = b2 % 128 | |
| 1297 | local mantissa = b0 + (b1 + b2_low * 256) * 256 | |
| 1298 | local exponent = (b2 - b2_low) / 128 + b3 % 128 * 2 | |
| 1299 | local number | |
| 1300 | if mantissa == 0 then | |
| 1301 | if exponent == 0 then | |
| 1302 | number = 0 | |
| 1303 | elseif exponent == 0xFF then | |
| 1304 | number = math.huge | |
| 1305 | else | |
| 1306 | number = 2 ^ (exponent - 127) | |
| 1307 | end | |
| 1308 | elseif exponent == 255 then | |
| 1309 | number = Serializer.NAN | |
| 1310 | else | |
| 1311 | number = (1 + mantissa / 8388608) * 2 ^ (exponent - 127) | |
| 1312 | end | |
| 1313 | if b3 >= 128 then | |
| 1314 | return -number | |
| 1315 | else | |
| 1316 | return number | |
| 1317 | end | |
| 1318 | end | |
| 1319 | function Serializer.EncodeColor3(color3) | |
| 1320 | return Serializer.EncodeFloatArray({color3.r, color3.g, color3.b}, {0, 0.5, 1})
| |
| 1321 | end | |
| 1322 | function Serializer.EncodeFloat32(number) | |
| 1323 | if number == 0 then | |
| 1324 | if 1 / number > 0 then | |
| 1325 | return "\0\0\0\0" | |
| 1326 | else | |
| 1327 | return "\0\0\0\128" | |
| 1328 | end | |
| 1329 | elseif number ~= number then | |
| 1330 | if string.sub(tostring(number), 1, 1) == "-" then | |
| 1331 | return "\255\255\255\255" | |
| 1332 | else | |
| 1333 | return "\255\255\255\127" | |
| 1334 | end | |
| 1335 | elseif number == math.huge then | |
| 1336 | return "\0\0\128\127" | |
| 1337 | elseif number == -math.huge then | |
| 1338 | return "\0\0\128\255" | |
| 1339 | else | |
| 1340 | local b3 = 0 | |
| 1341 | if number < 0 then | |
| 1342 | number = -number | |
| 1343 | b3 = 128 | |
| 1344 | end | |
| 1345 | local mantissa, exponent = math.frexp(number) | |
| 1346 | exponent = exponent + 126 | |
| 1347 | if exponent < 0 then | |
| 1348 | return "\0\0\0" .. string.char(b3) | |
| 1349 | elseif exponent >= 255 then | |
| 1350 | return "\0\0\128" .. string.char(b3 + 0x7F) | |
| 1351 | else | |
| 1352 | local fraction = mantissa * 16777216 - 8388608 + 0.5 | |
| 1353 | fraction = fraction - fraction % 1 | |
| 1354 | local exponent_low = exponent % 2 | |
| 1355 | local b0 = fraction % 256 | |
| 1356 | local b1 = fraction % 65536 | |
| 1357 | local b2 = (fraction - b1) / 65536 + exponent_low * 128 | |
| 1358 | b1 = (b1 - b0) / 256 | |
| 1359 | b3 = b3 + (exponent - exponent_low) / 2 | |
| 1360 | return string.char(b0, b1, b2, b3) | |
| 1361 | end | |
| 1362 | end | |
| 1363 | end | |
| 1364 | ||
| 1365 | LuaEnum = {};
| |
| 1366 | ||
| 1367 | LuaEnum.enum_metatable = {
| |
| 1368 | __call = function(self, value) | |
| 1369 | local valueType = type(value) | |
| 1370 | if valueType == "table" and getmetatable(value) == LuaEnum.enum_item_metatable then | |
| 1371 | return value | |
| 1372 | else | |
| 1373 | return self[value] | |
| 1374 | end | |
| 1375 | end, | |
| 1376 | __index = function(self, key) | |
| 1377 | local enumItem = self.ItemsByName[key] or self.ItemsByValue[key] | |
| 1378 | if enumItem == nil then | |
| 1379 | local default = self.Default | |
| 1380 | if default then | |
| 1381 | Logger.printf("Warning", "%s is not a valid EnumItem, returning default (%s)", Utility.ToString(key), tostring(default))
| |
| 1382 | enumItem = default | |
| 1383 | else | |
| 1384 | Logger.errorf(2, "%s is not a valid EnumItem", Utility.ToString(key)) | |
| 1385 | end | |
| 1386 | end | |
| 1387 | return enumItem | |
| 1388 | end, | |
| 1389 | __tostring = function(self) | |
| 1390 | return self.Name | |
| 1391 | end | |
| 1392 | } | |
| 1393 | LuaEnum.enum_item_metatable = {
| |
| 1394 | __tostring = function(self) | |
| 1395 | return self.Enum.Name .. "." .. self.Name | |
| 1396 | end | |
| 1397 | } | |
| 1398 | LuaEnum.init_metatable = {
| |
| 1399 | __call = function(self, items) | |
| 1400 | local enumItemsByName = {}
| |
| 1401 | local enumItemsByValue = {}
| |
| 1402 | local enum = {
| |
| 1403 | ItemsByName = enumItemsByName, | |
| 1404 | ItemsByValue = enumItemsByValue, | |
| 1405 | Name = self[1] | |
| 1406 | } | |
| 1407 | local default = items.Default | |
| 1408 | if default ~= nil then | |
| 1409 | items.Default = nil | |
| 1410 | end | |
| 1411 | for value, name in pairs(items) do | |
| 1412 | local enumItem = setmetatable({
| |
| 1413 | Enum = enum, | |
| 1414 | Name = name, | |
| 1415 | Value = value | |
| 1416 | }, LuaEnum.enum_item_metatable) | |
| 1417 | enumItemsByName[name] = enumItem | |
| 1418 | enumItemsByValue[value] = enumItem | |
| 1419 | if name == default or value == default then | |
| 1420 | enum.Default = enumItem | |
| 1421 | end | |
| 1422 | end | |
| 1423 | return setmetatable(enum, LuaEnum.enum_metatable) | |
| 1424 | end | |
| 1425 | } | |
| 1426 | function LuaEnum.new(name) | |
| 1427 | return setmetatable({name}, LuaEnum.init_metatable)
| |
| 1428 | end | |
| 1429 | ||
| 1430 | Logger = {};
| |
| 1431 | ||
| 1432 | Logger.entries = {0}
| |
| 1433 | Logger.MessageType = LuaEnum.new "MessageType" {
| |
| 1434 | "Output", | |
| 1435 | "Info", | |
| 1436 | "Warning", | |
| 1437 | "Severe", | |
| 1438 | "Error", | |
| 1439 | Default = "Severe" | |
| 1440 | } | |
| 1441 | Logger.MESSAGE_TYPE_SETTINGS = {
| |
| 1442 | { -- Output
| |
| 1443 | Font = "Arial", | |
| 1444 | TextColor3 = Color3.new(0, 0, 0) | |
| 1445 | }, | |
| 1446 | { -- Info
| |
| 1447 | Font = "Arial", | |
| 1448 | TextColor3 = Color3.new(0, 0, 1) | |
| 1449 | }, | |
| 1450 | { -- Warning
| |
| 1451 | Font = "ArialBold", | |
| 1452 | TextColor3 = Color3.new(1, 0.5, 0) | |
| 1453 | }, | |
| 1454 | { -- Severe/Error
| |
| 1455 | Font = "ArialBold", | |
| 1456 | TextColor3 = Color3.new(1, 0, 0) | |
| 1457 | } | |
| 1458 | } | |
| 1459 | Logger.MAX_ENTRIES = 160 | |
| 1460 | Logger.WARNING_TRACE_ITEM_COUNT = 5 | |
| 1461 | Logger.rbxPrint = getfenv(RbxUtility.CreateSignal).print | |
| 1462 | function Logger.error(level, message) | |
| 1463 | message = message .. "\n" .. Logger.StackTraceToString(Logger.GenerateStackTrace(level + 1)) | |
| 1464 | Logger.AddEntry {Logger.MessageType.Error, message}
| |
| 1465 | error(level + 1, message) | |
| 1466 | end | |
| 1467 | function Logger.errorf(level, messageFormat, ...) | |
| 1468 | Logger.error(level + 1, string.format(messageFormat, ...)) | |
| 1469 | end | |
| 1470 | function Logger.print(messageType, message, level) | |
| 1471 | messageType = Logger.MessageType(messageType) | |
| 1472 | local entry = {messageType, message}
| |
| 1473 | Logger.rbxPrint(Logger.EntryToString(entry)) | |
| 1474 | Logger.AddEntry(entry) | |
| 1475 | if level ~= false and messageType.Value >= Logger.MessageType.Warning.Value then | |
| 1476 | local maxItems | |
| 1477 | if messageType.Value >= Logger.MessageType.Severe.Value then | |
| 1478 | maxItems = math.huge | |
| 1479 | else | |
| 1480 | maxItems = Logger.WARNING_TRACE_ITEM_COUNT | |
| 1481 | end | |
| 1482 | local trace = Logger.GenerateStackTrace((level or 1) + 1, math.huge, 10, maxItems + 1) | |
| 1483 | local traceLength = #trace | |
| 1484 | local stackTraceMessage | |
| 1485 | local suffix = "" | |
| 1486 | if traceLength > maxItems then | |
| 1487 | trace[traceLength] = nil | |
| 1488 | suffix = "\n..." | |
| 1489 | end | |
| 1490 | Logger.print("Info", "Stack trace:\n" .. Logger.StackTraceToString(trace) .. suffix .. "\nStack end", false)
| |
| 1491 | end | |
| 1492 | end | |
| 1493 | function Logger.printf(messageType, messageFormat, ...) | |
| 1494 | Logger.print(messageType, string.format(messageFormat, ...), 2) | |
| 1495 | end | |
| 1496 | function Logger.AddEntry(entry) | |
| 1497 | local entries = Logger.entries | |
| 1498 | if entries[1] >= Logger.MAX_ENTRIES then | |
| 1499 | local first = entries[2] | |
| 1500 | local nextFirst = first[2] | |
| 1501 | first[1] = nil | |
| 1502 | first[2] = nil | |
| 1503 | entries[1] = entries[1] - 1 | |
| 1504 | entries[2] = nextFirst | |
| 1505 | if not nextFirst then | |
| 1506 | entries[3] = nil | |
| 1507 | end | |
| 1508 | end | |
| 1509 | local last = entries[3] | |
| 1510 | local node = {entry}
| |
| 1511 | if last then | |
| 1512 | entries[3] = node | |
| 1513 | last[2] = node | |
| 1514 | else | |
| 1515 | entries[2] = node | |
| 1516 | entries[3] = node | |
| 1517 | end | |
| 1518 | entries[1] = entries[1] + 1 | |
| 1519 | end | |
| 1520 | function Logger.NodeIterator(list, node) | |
| 1521 | if node then | |
| 1522 | node = node[2] | |
| 1523 | else | |
| 1524 | node = list[2] | |
| 1525 | end | |
| 1526 | if node then | |
| 1527 | return node, node[1] | |
| 1528 | end | |
| 1529 | end | |
| 1530 | function Logger.EntryToString(entry) | |
| 1531 | local messageType, message = entry[1], tostring(entry[2]) | |
| 1532 | if messageType and messageType.Value >= Logger.MessageType.Info.Value then | |
| 1533 | return messageType.Name .. ": " .. message | |
| 1534 | else | |
| 1535 | return message | |
| 1536 | end | |
| 1537 | end | |
| 1538 | function Logger.GenerateStackTrace(level, maxLevel, maxTailCalls, maxTraceItems) | |
| 1539 | level = level + 2 | |
| 1540 | if maxLevel == nil then | |
| 1541 | maxLevel = math.huge | |
| 1542 | else | |
| 1543 | maxLevel = maxLevel + 2 | |
| 1544 | end | |
| 1545 | maxTailCalls = maxTailCalls or 10 | |
| 1546 | maxTraceItems = maxTraceItems or math.huge | |
| 1547 | local trace = {}
| |
| 1548 | local numTailCalls = 0 | |
| 1549 | while level <= maxLevel and numTailCalls <= maxTailCalls and #trace < maxTraceItems do | |
| 1550 | local success, errorMessage = xpcall(function() error("-", level + 1) end, function(...) return ... end)
| |
| 1551 | if errorMessage == "-" then | |
| 1552 | numTailCalls = numTailCalls + 1 | |
| 1553 | else | |
| 1554 | if numTailCalls > 0 then | |
| 1555 | local traceSize = #trace | |
| 1556 | if traceSize > 0 then | |
| 1557 | trace[#trace][3] = numTailCalls | |
| 1558 | end | |
| 1559 | numTailCalls = 0 | |
| 1560 | end | |
| 1561 | local script, line = string.match(errorMessage, "(.*):(%d+)") | |
| 1562 | trace[#trace + 1] = {script, tonumber(line), 0}
| |
| 1563 | end | |
| 1564 | level = level + 1 | |
| 1565 | end | |
| 1566 | return trace | |
| 1567 | end | |
| 1568 | function Logger.StackTraceToString(trace) | |
| 1569 | local buffer = {}
| |
| 1570 | for _, data in ipairs(trace) do | |
| 1571 | buffer[#buffer + 1] = string.format("Script %q, line %d", data[1], data[2])
| |
| 1572 | local numTailCalls = data[3] | |
| 1573 | if numTailCalls == 1 then | |
| 1574 | buffer[#buffer + 1] = "... 1 tail call" | |
| 1575 | elseif numTailCalls > 1 then | |
| 1576 | buffer[#buffer + 1] = string.format("... %d tail calls", numTailCalls)
| |
| 1577 | end | |
| 1578 | end | |
| 1579 | return table.concat(buffer, "\n") | |
| 1580 | end | |
| 1581 | function Logger.MessageOutFunc(message, messageType) | |
| 1582 | if AdvancedGUI and AdvancedGUI.Print then | |
| 1583 | local messageTypeValue | |
| 1584 | if messageType == Enum.MessageType.MessageOutput then | |
| 1585 | local tagName, untaggedMessage = string.match(message, "(%a+): (.*)") | |
| 1586 | if tagName == "Info" or tagName == "Warning" or tagName == "Severe" then | |
| 1587 | messageTypeValue = Logger.MessageType[tagName].Value | |
| 1588 | message = untaggedMessage | |
| 1589 | else | |
| 1590 | messageTypeValue = Logger.MessageType.Output.Value | |
| 1591 | end | |
| 1592 | else | |
| 1593 | messageTypeValue = messageType.Value + 1 | |
| 1594 | end | |
| 1595 | AdvancedGUI.PrintFormat(Logger.MESSAGE_TYPE_SETTINGS[messageTypeValue], message) | |
| 1596 | end | |
| 1597 | end | |
| 1598 | function print(...) | |
| 1599 | local args = {...}
| |
| 1600 | local buffer = {}
| |
| 1601 | for index = 1, select("#", ...) do
| |
| 1602 | buffer[index] = tostring(args[index]) | |
| 1603 | end | |
| 1604 | local message = table.concat(buffer, "\t") | |
| 1605 | Logger.print("Output", message)
| |
| 1606 | end | |
| 1607 | ||
| 1608 | CharacterAppearance = {};
| |
| 1609 | ||
| 1610 | CharacterAppearance.defaultAppearanceId = 2 | |
| 1611 | CharacterAppearance.stock = {}
| |
| 1612 | function CharacterAppearance.Create(properties) | |
| 1613 | local id = properties.Id | |
| 1614 | local bodyColors = Instance.new("BodyColors")
| |
| 1615 | bodyColors.HeadColor = properties.HeadColor | |
| 1616 | bodyColors.TorsoColor = properties.TorsoColor | |
| 1617 | bodyColors.RightArmColor = properties.RightArmColor | |
| 1618 | bodyColors.LeftArmColor = properties.LeftArmColor | |
| 1619 | bodyColors.RightLegColor = properties.RightLegColor | |
| 1620 | bodyColors.LeftLegColor = properties.LeftLegColor | |
| 1621 | local characterObjects = {bodyColors}
| |
| 1622 | local headObjects = {}
| |
| 1623 | local data = {
| |
| 1624 | characterObjects = characterObjects, | |
| 1625 | headObjects = headObjects, | |
| 1626 | tshirt = properties.TShirt | |
| 1627 | } | |
| 1628 | for _, assetId in ipairs(properties.CharacterAssets) do | |
| 1629 | TaskScheduler.Start(CharacterAppearance.LoadAsset, characterObjects, assetId) | |
| 1630 | end | |
| 1631 | for _, assetId in ipairs(properties.HeadAssets) do | |
| 1632 | TaskScheduler.Start(CharacterAppearance.LoadAsset, headObjects, assetId) | |
| 1633 | end | |
| 1634 | CharacterAppearance.stock[id] = data | |
| 1635 | end | |
| 1636 | function CharacterAppearance.GetDefaultAppearance() | |
| 1637 | return CharacterAppearance.stock[CharacterAppearance.defaultAppearanceId] | |
| 1638 | end | |
| 1639 | function CharacterAppearance.LoadAsset(objects, assetId) | |
| 1640 | local asset = InsertService:LoadAsset(assetId) | |
| 1641 | for _, child in ipairs(asset:GetChildren()) do | |
| 1642 | child.Archivable = true | |
| 1643 | table.insert(objects, child:Clone()) | |
| 1644 | end | |
| 1645 | end | |
| 1646 | CharacterAppearance.Create {
| |
| 1647 | Id = 1, | |
| 1648 | HeadColor = BrickColor.new("Institutional white"),
| |
| 1649 | TorsoColor = BrickColor.new("Institutional white"),
| |
| 1650 | RightArmColor = BrickColor.new("Institutional white"),
| |
| 1651 | LeftArmColor = BrickColor.new("Institutional white"),
| |
| 1652 | RightLegColor = BrickColor.new("Institutional white"),
| |
| 1653 | LeftLegColor = BrickColor.new("Institutional white"),
| |
| 1654 | CharacterAssets = {
| |
| 1655 | 90825058, 90825211, | |
| 1656 | 27112056, 27112052, | |
| 1657 | 27112039, 27112025, | |
| 1658 | 27112068, 38322996 | |
| 1659 | }, | |
| 1660 | HeadAssets = {
| |
| 1661 | 20722130, | |
| 1662 | 8330576 | |
| 1663 | } | |
| 1664 | } | |
| 1665 | CharacterAppearance.Create {
| |
| 1666 | Id = 2, | |
| 1667 | HeadColor = BrickColor.new("Institutional white"),
| |
| 1668 | TorsoColor = BrickColor.new("Institutional white"),
| |
| 1669 | RightArmColor = BrickColor.new("Institutional white"),
| |
| 1670 | LeftArmColor = BrickColor.new("Institutional white"),
| |
| 1671 | RightLegColor = BrickColor.new("Institutional white"),
| |
| 1672 | LeftLegColor = BrickColor.new("Institutional white"),
| |
| 1673 | CharacterAssets = {
| |
| 1674 | 90825058, 90825211, | |
| 1675 | 11748356, 1029025, | |
| 1676 | 1235488, 27112056, | |
| 1677 | 27112052, 27112039, | |
| 1678 | 27112025, 27112068 | |
| 1679 | }, | |
| 1680 | HeadAssets = {
| |
| 1681 | 20722130 | |
| 1682 | } | |
| 1683 | } | |
| 1684 | CharacterAppearance.Create {
| |
| 1685 | Id = 3, | |
| 1686 | HeadColor = BrickColor.new("Pastel brown"),
| |
| 1687 | TorsoColor = BrickColor.new("Pastel brown"),
| |
| 1688 | RightArmColor = BrickColor.new("Pastel brown"),
| |
| 1689 | LeftArmColor = BrickColor.new("Pastel brown"),
| |
| 1690 | RightLegColor = BrickColor.new("White"),
| |
| 1691 | LeftLegColor = BrickColor.new("White"),
| |
| 1692 | CharacterAssets = {
| |
| 1693 | 134289125, 48474356, | |
| 1694 | 100339040, 46302558, | |
| 1695 | 153955895 | |
| 1696 | }, | |
| 1697 | HeadAssets = {},
| |
| 1698 | TShirt = "rbxassetid://148856353" | |
| 1699 | } | |
| 1700 | CharacterAppearance.Create {
| |
| 1701 | Id = 4, | |
| 1702 | HeadColor = BrickColor.new("Pastel brown"),
| |
| 1703 | TorsoColor = BrickColor.new("Pastel brown"),
| |
| 1704 | RightArmColor = BrickColor.new("Pastel brown"),
| |
| 1705 | LeftArmColor = BrickColor.new("Pastel brown"),
| |
| 1706 | RightLegColor = BrickColor.new("White"),
| |
| 1707 | LeftLegColor = BrickColor.new("White"),
| |
| 1708 | CharacterAssets = {
| |
| 1709 | 129458426, 96678344, 184489190 | |
| 1710 | }, | |
| 1711 | HeadAssets = {},
| |
| 1712 | TShirt = "rbxassetid://160146697" | |
| 1713 | } | |
| 1714 | ||
| 1715 | GraphicalEffects = {};
| |
| 1716 | ||
| 1717 | local MESH_IDS = {"rbxassetid://15310891"}
| |
| 1718 | local SOUND_IDS = {"rbxassetid://2248511", "rbxassetid://1369158"}
| |
| 1719 | local TEXTURE_IDS = {"rbxassetid://36527089", "rbxassetid://122610943", "rbxassetid://126561317", "rbxassetid://127033719"}
| |
| 1720 | local preloadConnections = {}
| |
| 1721 | local reloadingPreloads = false | |
| 1722 | function GraphicalEffects.InitPreloads() | |
| 1723 | local preload_part = Instance.new("Part")
| |
| 1724 | GraphicalEffects.preload_part = preload_part | |
| 1725 | preload_part.Anchored = true | |
| 1726 | preload_part.Archivable = false | |
| 1727 | preload_part.BottomSurface = "Smooth" | |
| 1728 | preload_part.CanCollide = false | |
| 1729 | preload_part.CFrame = CFrame.new(math.huge, math.huge, math.huge) | |
| 1730 | preload_part.FormFactor = "Custom" | |
| 1731 | preload_part.Locked = true | |
| 1732 | preload_part.Name = "Asset Preloader" | |
| 1733 | preload_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 1734 | preload_part.TopSurface = "Smooth" | |
| 1735 | preload_part.Transparency = 1 | |
| 1736 | preloadConnections[preload_part] = preload_part.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged) | |
| 1737 | for _, mesh_id in ipairs(MESH_IDS) do | |
| 1738 | local mesh = Instance.new("SpecialMesh")
| |
| 1739 | mesh.MeshType = "FileMesh" | |
| 1740 | mesh.MeshId = mesh_id | |
| 1741 | preloadConnections[mesh] = mesh.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged) | |
| 1742 | mesh.Parent = preload_part | |
| 1743 | end | |
| 1744 | for _, sound_id in ipairs(SOUND_IDS) do | |
| 1745 | local sound = Instance.new("Sound")
| |
| 1746 | sound.SoundId = sound_id | |
| 1747 | sound.Volume = 0 | |
| 1748 | preloadConnections[sound] = sound.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged) | |
| 1749 | sound.Parent = preload_part | |
| 1750 | end | |
| 1751 | for _, texture_id in ipairs(TEXTURE_IDS) do | |
| 1752 | local decal = Instance.new("Decal")
| |
| 1753 | decal.Texture = texture_id | |
| 1754 | preloadConnections[decal] = decal.AncestryChanged:connect(GraphicalEffects.PreloadsAncestryChanged) | |
| 1755 | decal.Parent = preload_part | |
| 1756 | end | |
| 1757 | preload_part.Parent = Workspace | |
| 1758 | end | |
| 1759 | function GraphicalEffects.PreloadsAncestryChanged(child, parent) | |
| 1760 | if not reloadingPreloads and parent ~= GraphicalEffects.preload_part and parent ~= Workspace then | |
| 1761 | reloadingPreloads = true | |
| 1762 | for _, connection in pairs(preloadConnections) do | |
| 1763 | connection:disconnect() | |
| 1764 | preloadConnections[_] = nil | |
| 1765 | end | |
| 1766 | wait(1) | |
| 1767 | reloadingPreloads = false | |
| 1768 | GraphicalEffects.InitPreloads() | |
| 1769 | end | |
| 1770 | end | |
| 1771 | GraphicalEffects.InitPreloads() | |
| 1772 | -- Hyper beam | |
| 1773 | function GraphicalEffects.FireSpaceHyperBeam(target, power, duration, radius, height, deviation) | |
| 1774 | local stepTime, gameTime = 1 / 30, TaskScheduler.GetCurrentTime() | |
| 1775 | local frames = duration * 30 | |
| 1776 | local beamColorOffset = 0.75 * tick() -- math.random() | |
| 1777 | local blastPressure = power * 62500 + 250000 | |
| 1778 | local beamPart = Instance.new("Part")
| |
| 1779 | local beamMesh = Instance.new("SpecialMesh", beamPart)
| |
| 1780 | local explosion = Instance.new("Explosion")
| |
| 1781 | local sound = Instance.new("Sound", beamPart)
| |
| 1782 | beamPart.Anchored = true | |
| 1783 | beamPart.CanCollide = false | |
| 1784 | beamPart.CFrame = CFrame.new(target, target + Vector3.new(deviation * (math.random() - 0.5), deviation * (math.random() - 0.5), height)) | |
| 1785 | beamPart.FormFactor = "Custom" | |
| 1786 | beamPart.Locked = true | |
| 1787 | beamPart.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 1788 | beamMesh.MeshId = "rbxassetid://15310891" | |
| 1789 | beamMesh.MeshType = "FileMesh" | |
| 1790 | beamMesh.TextureId = "rbxassetid://36527089" | |
| 1791 | local beamGlowPart1 = beamPart:Clone() | |
| 1792 | local beamGlowMesh1 = beamMesh:Clone() | |
| 1793 | local beamGlowPart2 = beamPart:Clone() | |
| 1794 | local beamGlowMesh2 = beamMesh:Clone() | |
| 1795 | local beamLight = Instance.new("PointLight", beamPart)
| |
| 1796 | beamLight.Range = power * 2 | |
| 1797 | beamLight.Shadows = true | |
| 1798 | explosion.BlastPressure = blastPressure | |
| 1799 | explosion.BlastRadius = power | |
| 1800 | explosion.Position = target | |
| 1801 | sound.SoundId = "rbxassetid://2248511" | |
| 1802 | sound.Volume = 1 | |
| 1803 | local explosionHitConnection = explosion.Hit:connect(function(part, distance) | |
| 1804 | if not part.Anchored and part:GetMass() < power * power then | |
| 1805 | pcall(part.BreakJoints, part) | |
| 1806 | part.Color = Color3.new(Utility.GetRainbowRGB(1.5 * gameTime + beamColorOffset)) | |
| 1807 | end | |
| 1808 | end) | |
| 1809 | beamPart.Transparency = 0.5 | |
| 1810 | beamPart.Archivable = false | |
| 1811 | beamGlowPart1.Transparency = 0.75 | |
| 1812 | beamGlowPart2.Transparency = 0.75 | |
| 1813 | beamGlowMesh1.Parent = beamGlowPart1 | |
| 1814 | beamGlowPart1.Parent = beamPart | |
| 1815 | beamGlowMesh2.Parent = beamGlowPart2 | |
| 1816 | beamGlowPart2.Parent = beamPart | |
| 1817 | beamPart.Parent = workspace | |
| 1818 | explosion.Parent = workspace | |
| 1819 | for frame = 1, frames do | |
| 1820 | local progress = frame / frames | |
| 1821 | local alpha = 1 - math.sin(0.5 * math.pi * progress) | |
| 1822 | local scale = 0.4 * alpha | |
| 1823 | local glowScale1 = alpha * (0.5 + 0.5 * math.sin(math.tau * (8 * gameTime + beamColorOffset))) | |
| 1824 | local glowScale2 = alpha * (0.5 + 0.5 * math.cos(math.tau * (8 * gameTime + beamColorOffset))) | |
| 1825 | local vertexColor = Vector3.new(Utility.GetRainbowRGB(1.5 * gameTime + beamColorOffset)) | |
| 1826 | beamLight.Brightness = 1 - progress | |
| 1827 | beamLight.Color = Color3.new(vertexColor.x, vertexColor.y, vertexColor.z) | |
| 1828 | beamMesh.Scale = Vector3.new(radius * scale, 9000, radius * scale) | |
| 1829 | beamMesh.VertexColor = vertexColor | |
| 1830 | beamGlowMesh1.Scale = Vector3.new(1.2 * radius * glowScale1, 9000, 1.2 * radius * glowScale1) | |
| 1831 | beamGlowMesh1.VertexColor = vertexColor | |
| 1832 | beamGlowMesh2.Scale = Vector3.new(1.2 * radius * glowScale2, 9000, 1.2 * radius * glowScale2) | |
| 1833 | beamGlowMesh2.VertexColor = vertexColor | |
| 1834 | RunService.Stepped:wait() | |
| 1835 | gameTime = TaskScheduler.GetCurrentTime() | |
| 1836 | if frame <= 2 then | |
| 1837 | local explosion = Instance.new("Explosion")
| |
| 1838 | explosion.BlastPressure = (1 - progress) * blastPressure | |
| 1839 | explosion.BlastRadius = (1 - progress) * power | |
| 1840 | explosion.Position = target | |
| 1841 | explosion.Parent = Workspace | |
| 1842 | if frame == 2 then | |
| 1843 | sound:Play() | |
| 1844 | end | |
| 1845 | end | |
| 1846 | end | |
| 1847 | pcall(beamPart.Destroy, beamPart) | |
| 1848 | explosionHitConnection:disconnect() | |
| 1849 | end | |
| 1850 | function GraphicalEffects.SpaceHyperBeam(target, power, duration, radius, height, deviation) | |
| 1851 | TaskScheduler.Start(GraphicalEffects.FireSpaceHyperBeam, target, power or 12, duration or 1.5, radius or 6, height or 600, deviation or 20) | |
| 1852 | end | |
| 1853 | ||
| 1854 | function GraphicalEffects.CrystalRing(data) | |
| 1855 | data = data or {}
| |
| 1856 | local crystal_count = data.crystal_count or 10 | |
| 1857 | local crystal_color = data.crystal_color or BrickColor.new("Bright red")
| |
| 1858 | local crystal_scale = data.crystal_scale or Vector3.new(2 / 3, 2, 2 / 3) | |
| 1859 | local fade_out_color = data.fade_out_color or BrickColor.new("Really black")
| |
| 1860 | local radius = radius or 1.25 * crystal_count / math.pi | |
| 1861 | local spawn_duration = data.spawn_duration or 0.065 | |
| 1862 | local full_spawn_duration = spawn_duration * crystal_count | |
| 1863 | local float_duration = data.float_duration or 5 | |
| 1864 | local wave_amplitude = data.wave_amplitude or 0.5 | |
| 1865 | local wave_period = data.wave_period or 1 | |
| 1866 | local appear_duration = data.appear_duration or 0.1 | |
| 1867 | local disappear_duration = data.disappear_duration or 0.5 | |
| 1868 | local base_part = data.base_part | |
| 1869 | local offset_cframe | |
| 1870 | if data.position then | |
| 1871 | offset_cframe = CFrame.new(data.position) | |
| 1872 | if base_part then | |
| 1873 | offset_cframe = base_part.CFrame:toObjectSpace(offset_cframe) | |
| 1874 | end | |
| 1875 | else | |
| 1876 | offset_cframe = CFrame.new() | |
| 1877 | end | |
| 1878 | local crystal_template = Instance.new("Part")
| |
| 1879 | crystal_template.Anchored = true | |
| 1880 | crystal_template.Locked = true | |
| 1881 | crystal_template.CanCollide = false | |
| 1882 | crystal_template.BottomSurface = "Smooth" | |
| 1883 | crystal_template.TopSurface = "Smooth" | |
| 1884 | crystal_template.BrickColor = crystal_color | |
| 1885 | crystal_template.FormFactor = "Symmetric" | |
| 1886 | crystal_template.Size = Vector3.new(1, 1, 1) | |
| 1887 | local crystal_light = Instance.new("PointLight", crystal_template)
| |
| 1888 | crystal_light.Brightness = 0.1 / crystal_count | |
| 1889 | crystal_light.Color = crystal_color.Color | |
| 1890 | crystal_light.Name = "Light" | |
| 1891 | crystal_light.Range = radius | |
| 1892 | crystal_light.Shadows = true | |
| 1893 | local crystal_mesh = Instance.new("SpecialMesh", crystal_template)
| |
| 1894 | crystal_mesh.MeshId = "rbxassetid://9756362" | |
| 1895 | crystal_mesh.MeshType = "FileMesh" | |
| 1896 | crystal_mesh.Name = "Mesh" | |
| 1897 | crystal_mesh.Scale = crystal_scale | |
| 1898 | local crystal_model = Instance.new("Model")
| |
| 1899 | crystal_model.Archivable = false | |
| 1900 | crystal_model.Name = "Crystal Model" | |
| 1901 | crystal_model.Parent = Workspace | |
| 1902 | local crystals = {}
| |
| 1903 | local lights = {}
| |
| 1904 | local meshes = {}
| |
| 1905 | for index = 1, crystal_count do | |
| 1906 | local crystal = crystal_template:Clone() | |
| 1907 | crystal.Parent = crystal_model | |
| 1908 | crystals[index] = crystal | |
| 1909 | lights[index] = crystal.Light | |
| 1910 | meshes[index] = crystal.Mesh | |
| 1911 | end | |
| 1912 | local start_time = tick() | |
| 1913 | repeat | |
| 1914 | local base_cframe = offset_cframe | |
| 1915 | if base_part then | |
| 1916 | base_cframe = base_part.CFrame * base_cframe | |
| 1917 | end | |
| 1918 | local elapsed_time = tick() - start_time | |
| 1919 | for index, crystal in ipairs(crystals) do | |
| 1920 | local crystal_time = elapsed_time - index * spawn_duration | |
| 1921 | local disappear_time = crystal_time - float_duration | |
| 1922 | local offset | |
| 1923 | if crystal_time < 0 then | |
| 1924 | offset = 0 | |
| 1925 | elseif crystal_time < appear_duration then | |
| 1926 | offset = radius * crystal_time / appear_duration | |
| 1927 | else | |
| 1928 | offset = radius | |
| 1929 | end | |
| 1930 | local wave_offset | |
| 1931 | if disappear_time >= 0 then | |
| 1932 | local disappear_progress = disappear_time / disappear_duration | |
| 1933 | if disappear_progress > 1 then | |
| 1934 | if crystal.Parent then | |
| 1935 | crystal:Destroy() | |
| 1936 | end | |
| 1937 | else | |
| 1938 | local inverse_progress = 1 - disappear_progress | |
| 1939 | local light = lights[index] | |
| 1940 | local mesh = meshes[index] | |
| 1941 | crystal.BrickColor = fade_out_color | |
| 1942 | light.Brightness = 2 * inverse_progress | |
| 1943 | light.Range = 2 * radius | |
| 1944 | mesh.Scale = crystal_scale * inverse_progress | |
| 1945 | end | |
| 1946 | wave_offset = 0 | |
| 1947 | else | |
| 1948 | wave_offset = wave_amplitude * math.sin(math.tau * (elapsed_time - index / crystal_count * 3) / wave_period) | |
| 1949 | end | |
| 1950 | local rotation_angle = (tick() * 0.5 + (index - 1) / crystal_count) % 1 * math.tau | |
| 1951 | crystal.CFrame = base_cframe * CFrame.Angles(0, rotation_angle, 0) * CFrame.new(0, wave_offset, -offset) | |
| 1952 | end | |
| 1953 | RunService.Stepped:wait() | |
| 1954 | until elapsed_time >= float_duration + full_spawn_duration + disappear_duration | |
| 1955 | if crystal_model.Parent then | |
| 1956 | crystal_model:Destroy() | |
| 1957 | end | |
| 1958 | end | |
| 1959 | ||
| 1960 | GraphicalEffects.magicCircleData = {}
| |
| 1961 | GraphicalEffects.MAGIC_CIRCLE_DEFAULT_OFFSET = 6.25 | |
| 1962 | function GraphicalEffects.AnimateMagicCircle(data) | |
| 1963 | local frame, direction, magic_circle_model, magic_circle_part, magic_circle_light, magic_circle_decal_back, magic_circle_decal_front, duration, | |
| 1964 | ||
| 1965 | stay, magic_circle_adornee_func, magic_circle_offset = unpack(data) | |
| 1966 | frame = frame + 1 | |
| 1967 | data[1] = frame | |
| 1968 | local transparency = (frame / duration) ^ stay | |
| 1969 | local opacity = 1 - transparency | |
| 1970 | if frame == duration then | |
| 1971 | pcall(Game.Destroy, magic_circle_model) | |
| 1972 | GraphicalEffects.magicCircleData[data] = nil | |
| 1973 | else | |
| 1974 | if magic_circle_model.Parent ~= Workspace then | |
| 1975 | pcall(Utility.SetProperty, magic_circle_model, "Parent", Workspace) | |
| 1976 | end | |
| 1977 | local magic_circle_adornee = magic_circle_adornee_func() | |
| 1978 | magic_circle_position = magic_circle_adornee.Position + direction * magic_circle_offset | |
| 1979 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, math.tau * frame / | |
| 1980 | ||
| 1981 | 25) | |
| 1982 | magic_circle_part.CFrame = magic_circle_cframe | |
| 1983 | magic_circle_light.Brightness = opacity | |
| 1984 | magic_circle_decal_back.Transparency = transparency | |
| 1985 | magic_circle_decal_front.Transparency = transparency | |
| 1986 | end | |
| 1987 | end | |
| 1988 | function GraphicalEffects.CreateMagicCircle(target, magic_circle_scale, magic_circle_image, light_color, duration, stay, magic_circle_adornee_func, | |
| 1989 | ||
| 1990 | magic_circle_offset) | |
| 1991 | local magic_circle_adornee = magic_circle_adornee_func() | |
| 1992 | if magic_circle_adornee then | |
| 1993 | local origin = magic_circle_adornee.Position | |
| 1994 | local direction = (target - origin).unit | |
| 1995 | local magic_circle_position = origin + direction * magic_circle_offset | |
| 1996 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) | |
| 1997 | local magic_circle_model = Instance.new("Model")
| |
| 1998 | local magic_circle_part = Instance.new("Part", magic_circle_model)
| |
| 1999 | local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part)
| |
| 2000 | local magic_circle_light = Instance.new("PointLight", magic_circle_part)
| |
| 2001 | local magic_circle_decal_back = Instance.new("Decal", magic_circle_part)
| |
| 2002 | local magic_circle_decal_front = Instance.new("Decal", magic_circle_part)
| |
| 2003 | magic_circle_model.Archivable = false | |
| 2004 | magic_circle_part.Anchored = true | |
| 2005 | magic_circle_part.BottomSurface = "Smooth" | |
| 2006 | magic_circle_part.CanCollide = false | |
| 2007 | magic_circle_part.CFrame = magic_circle_cframe | |
| 2008 | magic_circle_part.FormFactor = "Custom" | |
| 2009 | magic_circle_part.Locked = true | |
| 2010 | magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 2011 | magic_circle_part.TopSurface = "Smooth" | |
| 2012 | magic_circle_part.Transparency = 1 | |
| 2013 | magic_circle_mesh.Scale = Vector3.new(60, 60, 0) * magic_circle_scale | |
| 2014 | magic_circle_light.Color = light_color | |
| 2015 | magic_circle_light.Range = 16 * magic_circle_scale | |
| 2016 | magic_circle_light.Shadows = true | |
| 2017 | magic_circle_decal_back.Face = "Back" | |
| 2018 | magic_circle_decal_back.Texture = magic_circle_image | |
| 2019 | magic_circle_decal_front.Face = "Front" | |
| 2020 | magic_circle_decal_front.Texture = magic_circle_image | |
| 2021 | magic_circle_model.Parent = Workspace | |
| 2022 | local data = {0, direction, magic_circle_model, magic_circle_part, magic_circle_light, magic_circle_decal_back, magic_circle_decal_front,
| |
| 2023 | ||
| 2024 | duration, stay, magic_circle_adornee_func, magic_circle_offset} | |
| 2025 | GraphicalEffects.magicCircleData[data] = true | |
| 2026 | return data | |
| 2027 | end | |
| 2028 | end | |
| 2029 | ||
| 2030 | GraphicalEffects.missileData = {}
| |
| 2031 | GraphicalEffects.missileParts = {}
| |
| 2032 | function GraphicalEffects.AnimateMissile(data) | |
| 2033 | local frame, missilePart, targetPart, timeCreated, direction, touchedConnection, explodeRequested, bodyGyro, swooshSound, magicCircleData, lifeTime, | |
| 2034 | ||
| 2035 | pointOnPart, flipped = unpack(data) | |
| 2036 | frame = frame + 1 | |
| 2037 | data[1] = frame | |
| 2038 | if flipped then | |
| 2039 | direction = -direction | |
| 2040 | end | |
| 2041 | if frame <= 10 then | |
| 2042 | if frame == 2 then | |
| 2043 | swooshSound:Play() | |
| 2044 | end | |
| 2045 | missilePart.Anchored = true | |
| 2046 | local progress = frame / 10 | |
| 2047 | missilePart.Size = Vector3.new(1, 1, progress * 4) | |
| 2048 | local magicCirclePart = magicCircleData[4] | |
| 2049 | local magicCirclePosition = magicCirclePart.Position | |
| 2050 | local missileOffset = 2 * progress * direction | |
| 2051 | local missilePosition = magicCirclePosition + missileOffset | |
| 2052 | missilePart.CFrame = CFrame.new(missilePosition, missilePosition + direction) | |
| 2053 | --missilePart.Transparency = 0.5 * (1 - progress) | |
| 2054 | if frame == 10 then | |
| 2055 | touchedConnection = missilePart.Touched:connect(function(hit) | |
| 2056 | if hit.CanCollide and hit.Parent and not GraphicalEffects.missileParts[hit] then | |
| 2057 | touchedConnection:disconnect() | |
| 2058 | data[7] = true | |
| 2059 | end | |
| 2060 | end) | |
| 2061 | data[6] = touchedConnection | |
| 2062 | end | |
| 2063 | else | |
| 2064 | missilePart.Anchored = false | |
| 2065 | local missilePosition = missilePart.Position | |
| 2066 | local targetPosition = targetPart.CFrame * pointOnPart | |
| 2067 | local distanceVector = targetPosition - missilePosition | |
| 2068 | local elapsedTime = time() - timeCreated | |
| 2069 | local targetParent = targetPart.Parent | |
| 2070 | if explodeRequested or (targetParent and distanceVector.magnitude < 10) or elapsedTime > lifeTime then | |
| 2071 | GraphicalEffects.missileData[data] = nil | |
| 2072 | GraphicalEffects.missileParts[missilePart] = nil | |
| 2073 | touchedConnection:disconnect() | |
| 2074 | if missilePart.Parent then | |
| 2075 | missilePart:Destroy() | |
| 2076 | local explosion = Instance.new("Explosion")
| |
| 2077 | explosion.BlastRadius = 12.5 | |
| 2078 | explosion.Position = missilePosition | |
| 2079 | local explosionHitConnection = explosion.Hit:connect(function(hit, distance) | |
| 2080 | local missileData = GraphicalEffects.missileParts[hit] | |
| 2081 | if missileData and distance < 3 then | |
| 2082 | missileData[7] = true | |
| 2083 | else | |
| 2084 | pcall(hit.BreakJoints, hit) | |
| 2085 | end | |
| 2086 | end) | |
| 2087 | explosion.Parent = Workspace | |
| 2088 | TaskScheduler.Schedule(1, explosionHitConnection.disconnect, explosionHitConnection) | |
| 2089 | end | |
| 2090 | else | |
| 2091 | local targetInWorkspace = targetPart:IsDescendantOf(Workspace) | |
| 2092 | if targetInWorkspace then | |
| 2093 | direction = distanceVector.unit | |
| 2094 | data[5] = direction | |
| 2095 | end | |
| 2096 | local speed = 14 + elapsedTime * 10 | |
| 2097 | local gyroD | |
| 2098 | if elapsedTime < 42.5 and targetInWorkspace then | |
| 2099 | gyroD = 1000 - elapsedTime * 15 | |
| 2100 | else | |
| 2101 | gyroD = 100 | |
| 2102 | bodyGyro.maxTorque = Vector3.new(0, 0, 0) | |
| 2103 | if elapsedTime + 7.5 < lifeTime then | |
| 2104 | data[11] = elapsedTime + 7.5 | |
| 2105 | end | |
| 2106 | end | |
| 2107 | bodyGyro.D = gyroD | |
| 2108 | bodyGyro.cframe = CFrame.new(Vector3.new(), direction) | |
| 2109 | missilePart.Velocity = missilePart.CFrame.lookVector * speed | |
| 2110 | end | |
| 2111 | end | |
| 2112 | end | |
| 2113 | function GraphicalEffects.ShootMissile(targetPart, pointOnPart, direction, magic_circle_adornee_func, magic_circle_offset, flipped) | |
| 2114 | if not magic_circle_offset then | |
| 2115 | magic_circle_offset = GraphicalEffects.MAGIC_CIRCLE_DEFAULT_OFFSET | |
| 2116 | end | |
| 2117 | local targetPosition = targetPart.Position | |
| 2118 | local headPosition = chatAdornee.Position | |
| 2119 | local origin = CFrame.new(headPosition, headPosition + direction) + direction * magic_circle_offset | |
| 2120 | local missilePart = Instance.new("Part")
| |
| 2121 | local antiGravityForce = Instance.new("BodyForce", missilePart)
| |
| 2122 | local bodyGyro = Instance.new("BodyGyro", missilePart)
| |
| 2123 | local explosionSound = Instance.new("Sound", missilePart)
| |
| 2124 | local swooshSound = Instance.new("Sound", missilePart)
| |
| 2125 | antiGravityForce.force = Vector3.new(0, 196.2 * 4, 0) | |
| 2126 | bodyGyro.D = 1000 | |
| 2127 | bodyGyro.maxTorque = Vector3.new(1, 1, 1) | |
| 2128 | explosionSound.PlayOnRemove = true | |
| 2129 | explosionSound.SoundId = "rbxasset://sounds/collide.wav" | |
| 2130 | explosionSound.Volume = 1 | |
| 2131 | missilePart.Anchored = true | |
| 2132 | missilePart.BackSurface = "Studs" | |
| 2133 | missilePart.BottomSurface = "Studs" | |
| 2134 | missilePart.BrickColor = BrickColor.Red() | |
| 2135 | missilePart.CFrame = origin | |
| 2136 | missilePart.FormFactor = "Custom" | |
| 2137 | missilePart.FrontSurface = "Studs" | |
| 2138 | missilePart.LeftSurface = "Studs" | |
| 2139 | missilePart.Locked = true | |
| 2140 | missilePart.RightSurface = "Studs" | |
| 2141 | missilePart.Size = Vector3.new(1, 1, 0.2) | |
| 2142 | missilePart.TopSurface = "Studs" | |
| 2143 | --missilePart.Transparency = 0.5 | |
| 2144 | swooshSound.Looped = true | |
| 2145 | swooshSound.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav" | |
| 2146 | swooshSound.Volume = 0.7 | |
| 2147 | local magicCircleData = GraphicalEffects.CreateMagicCircle(headPosition + direction * 1000, 0.875, "rbxassetid://127033719", Color3.new(1, 1, 1), | |
| 2148 | ||
| 2149 | 40, 4, magic_circle_adornee_func or function() return chatAdornee end, magic_circle_offset) | |
| 2150 | local data = {0, missilePart, targetPart, time(), direction, false, false, bodyGyro, swooshSound, magicCircleData, 50, pointOnPart, flipped}
| |
| 2151 | missilePart.Parent = Workspace | |
| 2152 | GraphicalEffects.missileData[data] = true | |
| 2153 | GraphicalEffects.missileParts[missilePart] = data | |
| 2154 | end | |
| 2155 | ||
| 2156 | function GraphicalEffects.CubicInterpolate(y0, y1, y2, y3, mu) | |
| 2157 | local a0, a1, a2, a3, mu2 | |
| 2158 | mu2 = mu * mu | |
| 2159 | a0 = y3 - y2 - y0 + y1 | |
| 2160 | a1 = y0 - y1 - a0 | |
| 2161 | a2 = y2 - y0 | |
| 2162 | a3 = y1 | |
| 2163 | return a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3 | |
| 2164 | end | |
| 2165 | function GraphicalEffects.JointCrap(model, cycletime) | |
| 2166 | if model then | |
| 2167 | local cycletime = cycletime or (0.75 * (1 + math.random() * 4)) | |
| 2168 | local offsetradius = 0.75 | |
| 2169 | local rotationoffset = math.pi | |
| 2170 | local joints = {}
| |
| 2171 | local stack = model:GetChildren() | |
| 2172 | while #stack ~= 0 do | |
| 2173 | local object = stack[#stack] | |
| 2174 | table.remove(stack) | |
| 2175 | for index, child in ipairs(object:GetChildren()) do | |
| 2176 | table.insert(stack, child) | |
| 2177 | end | |
| 2178 | if object:IsA("JointInstance") then
| |
| 2179 | table.insert(joints, object) | |
| 2180 | end | |
| 2181 | end | |
| 2182 | local rot0 = {}
| |
| 2183 | local rot1 = {}
| |
| 2184 | local rot2 = {}
| |
| 2185 | local rot3 = {}
| |
| 2186 | local rot4 = {}
| |
| 2187 | for index, joint in ipairs(joints) do | |
| 2188 | local pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius | |
| 2189 | local rot = Vector3.new(math.random(), math.random(), math.random()) * rotationoffset | |
| 2190 | rot0[index] = {joint.C0, joint.C1}
| |
| 2191 | rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau)) | |
| 2192 | rot2[index] = {pos, rot}
| |
| 2193 | pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius | |
| 2194 | rot = rot + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset | |
| 2195 | rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau)) | |
| 2196 | rot3[index] = {pos, rot}
| |
| 2197 | pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius | |
| 2198 | rot = rot + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset | |
| 2199 | rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau)) | |
| 2200 | rot4[index] = {pos, rot}
| |
| 2201 | end | |
| 2202 | while model.Parent do | |
| 2203 | for i, j in ipairs(joints) do | |
| 2204 | local pos = Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5).unit * offsetradius | |
| 2205 | local rot = rot4[i][2] + Vector3.new(math.random(), math.random(), math.random()) * rotationoffset | |
| 2206 | rot = Vector3.new(rot.x % (math.tau), rot.y % (math.tau), rot.z % (math.tau)) | |
| 2207 | rot1[i], rot2[i], rot3[i], rot4[i] = rot2[i], rot3[i], rot4[i], {pos, rot}
| |
| 2208 | end | |
| 2209 | local start = tick() | |
| 2210 | while true do | |
| 2211 | local ctime = tick() | |
| 2212 | local elapsed = ctime - start | |
| 2213 | if elapsed > cycletime then | |
| 2214 | break | |
| 2215 | end | |
| 2216 | local progress = elapsed / cycletime | |
| 2217 | for index, joint in ipairs(joints) do | |
| 2218 | local v0, v1, v2, v3, v4 = rot0[index], rot1[index], rot2[index], rot3[index], rot4[index] | |
| 2219 | local p1, p2, p3, p4, r1, r2, r3, r4 = v1[1], v2[1], v3[1], v4[1], v1[2], v2[2], v3[2], v4[2] | |
| 2220 | local px = GraphicalEffects.CubicInterpolate(p1.x, p2.x, p3.x, p4.x, progress) | |
| 2221 | local py = GraphicalEffects.CubicInterpolate(p1.y, p2.y, p3.y, p4.y, progress) | |
| 2222 | local pz = GraphicalEffects.CubicInterpolate(p1.z, p2.z, p3.z, p4.z, progress) | |
| 2223 | local rx = GraphicalEffects.CubicInterpolate(r1.x, r2.x, r3.x, r4.x, progress) | |
| 2224 | local ry = GraphicalEffects.CubicInterpolate(r1.y, r2.y, r3.y, r4.y, progress) | |
| 2225 | local rz = GraphicalEffects.CubicInterpolate(r1.z, r2.z, r3.z, r4.z, progress) | |
| 2226 | local cframe = CFrame.new(px, py, pz) * CFrame.Angles(rx, ry, rz) | |
| 2227 | joint.C0 = v0[1] * cframe | |
| 2228 | joint.C1 = v0[2] * cframe:inverse() | |
| 2229 | end | |
| 2230 | RunService.Stepped:wait() | |
| 2231 | end | |
| 2232 | end | |
| 2233 | end | |
| 2234 | end | |
| 2235 | ||
| 2236 | GraphicalEffects.LASER_WIDTH = 0.15 | |
| 2237 | GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE = 6.25 | |
| 2238 | GraphicalEffects.laser_data = {}
| |
| 2239 | --GraphicalEffects.fragmentation = {}
| |
| 2240 | function GraphicalEffects.AnimateLaserOfDeath(data) | |
| 2241 | local frame, directionOrientation, direction, magic_circle_model, laser_part, laser_mesh, magic_circle_part, magic_circle_light, | |
| 2242 | ||
| 2243 | magic_circle_decal_back, magic_circle_decal_front, sound, laser_scale, fragmentation_size, duration, laser_lights, laser_effects, stay, light_effects = | |
| 2244 | ||
| 2245 | unpack(data) | |
| 2246 | local laser_color = laser_part.Color | |
| 2247 | frame = frame + 1 | |
| 2248 | data[1] = frame | |
| 2249 | local transparency = (frame / duration) ^ stay | |
| 2250 | local opacity = 1 - transparency | |
| 2251 | if frame == 2 then | |
| 2252 | sound:Play() | |
| 2253 | end | |
| 2254 | if frame == duration then | |
| 2255 | pcall(Game.Destroy, magic_circle_model) | |
| 2256 | GraphicalEffects.laser_data[data] = nil | |
| 2257 | else | |
| 2258 | if magic_circle_model.Parent ~= Workspace then | |
| 2259 | pcall(Utility.SetProperty, magic_circle_model, "Parent", Workspace) | |
| 2260 | end | |
| 2261 | local laser_distance = 0 | |
| 2262 | local origin = chatAdornee.CFrame | |
| 2263 | if not light_effects then | |
| 2264 | direction = (origin * directionOrientation - origin.p).unit | |
| 2265 | end | |
| 2266 | local magic_circle_position = origin.p + direction * GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE | |
| 2267 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, math.tau * frame / | |
| 2268 | ||
| 2269 | 25) | |
| 2270 | local loop_scale = (laser_scale - 1) / 10 | |
| 2271 | for x_offset = -loop_scale, loop_scale, 2 do | |
| 2272 | for y_offset = -loop_scale, loop_scale, 2 do | |
| 2273 | local origin_position = magic_circle_cframe * Vector3.new(x_offset, y_offset, 0) | |
| 2274 | for index = 1, 8 do | |
| 2275 | local part, position | |
| 2276 | for ray_index = 1, 10 do | |
| 2277 | local ray = Ray.new(origin_position + direction * (999 * (ray_index - 1)), direction * 999) | |
| 2278 | part, position = Workspace:FindPartOnRay(ray, magic_circle_model) | |
| 2279 | if part then | |
| 2280 | break | |
| 2281 | end | |
| 2282 | end | |
| 2283 | if part then | |
| 2284 | laser_distance = (position - origin_position).magnitude | |
| 2285 | if frame % 8 == 1 and index == 1 then | |
| 2286 | Instance.new("Explosion", Workspace).Position = position
| |
| 2287 | end | |
| 2288 | if not part:IsA("Terrain") then
| |
| 2289 | pcall(part.BreakJoints, part) | |
| 2290 | local is_block = part:IsA("Part") and part.Shape == Enum.PartType.Block
| |
| 2291 | local mass = part:GetMass() | |
| 2292 | local size = part.Size | |
| 2293 | if (is_block and ((size.X < fragmentation_size and size.Y < fragmentation_size and size.Z < | |
| 2294 | ||
| 2295 | fragmentation_size) or (not part.Anchored and mass < 750))) or (not is_block and mass < 250000) then | |
| 2296 | local part_transparency = math.max(part.Transparency + 0.007 * fragmentation_size, 0.5) | |
| 2297 | if part_transparency >= 0.5 then -- temporarily to minimize debris | |
| 2298 | pcall(Game.Destroy, part) | |
| 2299 | else | |
| 2300 | local cframe = part.CFrame | |
| 2301 | part.Anchored = false | |
| 2302 | part.BrickColor = BrickColor.new("Medium stone grey")
| |
| 2303 | part.CanCollide = true | |
| 2304 | if part:IsA("FormFactorPart") then
| |
| 2305 | part.FormFactor = "Custom" | |
| 2306 | end | |
| 2307 | part.Size = size - Vector3.new(0.135, 0.135, 0.135) * fragmentation_size | |
| 2308 | part.Transparency = part_transparency | |
| 2309 | part.CFrame = cframe + direction * 5 | |
| 2310 | part.Velocity = part.Velocity + direction * 40 | |
| 2311 | end | |
| 2312 | elseif is_block then | |
| 2313 | local parts = {part}
| |
| 2314 | local model = Instance.new("Model", part.Parent)
| |
| 2315 | model.Name = "Fragments" | |
| 2316 | if size.X >= fragmentation_size then | |
| 2317 | size = Vector3.new(0.5, 1, 1) * size | |
| 2318 | local archivable = part.Archivable | |
| 2319 | local cframe = part.CFrame | |
| 2320 | part.FormFactor = "Custom" | |
| 2321 | part.Size = size | |
| 2322 | part.Archivable = true | |
| 2323 | local part_clone = part:Clone() | |
| 2324 | part.Archivable = archivable | |
| 2325 | part_clone.Archivable = archivable | |
| 2326 | part.CFrame = cframe * CFrame.new(-0.5 * size.X, 0, 0) | |
| 2327 | part_clone.CFrame = cframe * CFrame.new(0.5 * size.X, 0, 0) | |
| 2328 | part_clone.Parent = model | |
| 2329 | parts[2] = part_clone | |
| 2330 | end | |
| 2331 | if size.Y >= fragmentation_size then | |
| 2332 | size = Vector3.new(1, 0.5, 1) * size | |
| 2333 | for part_index = 1, #parts do | |
| 2334 | local part = parts[part_index] | |
| 2335 | local archivable = part.Archivable | |
| 2336 | local cframe = part.CFrame | |
| 2337 | part.FormFactor = "Custom" | |
| 2338 | part.Size = size | |
| 2339 | part.Archivable = true | |
| 2340 | local part_clone = part:Clone() | |
| 2341 | part.Archivable = archivable | |
| 2342 | part_clone.Archivable = archivable | |
| 2343 | part.CFrame = cframe * CFrame.new(0, -0.5 * size.Y, 0) | |
| 2344 | part_clone.CFrame = cframe * CFrame.new(0, 0.5 * size.Y, 0) | |
| 2345 | part_clone.Parent = model | |
| 2346 | table.insert(parts, part_clone) | |
| 2347 | end | |
| 2348 | end | |
| 2349 | if size.Z >= fragmentation_size then | |
| 2350 | size = Vector3.new(1, 1, 0.5) * size | |
| 2351 | for part_index = 1, #parts do | |
| 2352 | local part = parts[part_index] | |
| 2353 | local archivable = part.Archivable | |
| 2354 | local cframe = part.CFrame | |
| 2355 | part.FormFactor = "Custom" | |
| 2356 | part.Size = size | |
| 2357 | part.Archivable = true | |
| 2358 | local part_clone = part:Clone() | |
| 2359 | part.Archivable = archivable | |
| 2360 | part_clone.Archivable = archivable | |
| 2361 | part.CFrame = cframe * CFrame.new(0, 0, -0.5 * size.Z) | |
| 2362 | part_clone.CFrame = cframe * CFrame.new(0, 0, 0.5 * size.Z) | |
| 2363 | part_clone.Parent = model | |
| 2364 | table.insert(parts, part_clone) | |
| 2365 | end | |
| 2366 | end | |
| 2367 | for _, part in ipairs(parts) do | |
| 2368 | part:MakeJoints() | |
| 2369 | end | |
| 2370 | else | |
| 2371 | break | |
| 2372 | end | |
| 2373 | end | |
| 2374 | else | |
| 2375 | laser_distance = 9990 | |
| 2376 | break | |
| 2377 | end | |
| 2378 | end | |
| 2379 | end | |
| 2380 | end | |
| 2381 | local laser_cframe = magic_circle_cframe * CFrame.Angles(-0.5 * math.pi, 0, 0) | |
| 2382 | local laser_width = GraphicalEffects.LASER_WIDTH * opacity * laser_scale | |
| 2383 | local laser_mesh_offset = Vector3.new(0, 0.5 * laser_distance, 0) | |
| 2384 | laser_part.CFrame = laser_cframe | |
| 2385 | if laser_effects then | |
| 2386 | local laser_effect_data_1, laser_effect_data_2 = laser_effects[1], laser_effects[2] | |
| 2387 | local laser_effect_1, laser_effect_mesh_1 = laser_effect_data_1[1], laser_effect_data_1[2] | |
| 2388 | local laser_effect_2, laser_effect_mesh_2 = laser_effect_data_2[1], laser_effect_data_2[2] | |
| 2389 | laser_effect_1.CFrame = laser_cframe | |
| 2390 | laser_effect_2.CFrame = laser_cframe | |
| 2391 | laser_effect_mesh_1.Offset = laser_mesh_offset | |
| 2392 | laser_effect_mesh_2.Offset = laser_mesh_offset | |
| 2393 | local game_time = time() | |
| 2394 | local effect_scale_1 = 0.5 + 0.5 * math.sin(16 * math.pi * game_time) | |
| 2395 | local effect_scale_2 = 0.5 + 0.5 * math.cos(16 * math.pi * game_time) | |
| 2396 | laser_effect_mesh_1.Scale = 5 * Vector3.new(laser_width * effect_scale_1, laser_distance, laser_width * effect_scale_1) | |
| 2397 | laser_effect_mesh_2.Scale = 5 * Vector3.new(laser_width * effect_scale_2, laser_distance, laser_width * effect_scale_2) | |
| 2398 | laser_width = laser_width * 0.25 | |
| 2399 | end | |
| 2400 | laser_mesh.Offset = laser_mesh_offset | |
| 2401 | laser_mesh.Scale = 5 * Vector3.new(laser_width, laser_distance, laser_width) | |
| 2402 | magic_circle_part.CFrame = magic_circle_cframe | |
| 2403 | magic_circle_light.Brightness = opacity | |
| 2404 | magic_circle_decal_back.Transparency = transparency | |
| 2405 | magic_circle_decal_front.Transparency = transparency | |
| 2406 | if light_effects then | |
| 2407 | for index, data in ipairs(laser_lights) do | |
| 2408 | local laser_spotlight_part, laser_spotlight = data[1], data[2] | |
| 2409 | local laser_spotlight_offset = 30 * (index - 1) | |
| 2410 | if laser_spotlight_offset <= laser_distance then | |
| 2411 | laser_spotlight_part.CFrame = magic_circle_cframe * CFrame.new(0, 0, -laser_spotlight_offset) | |
| 2412 | laser_spotlight.Brightness = opacity | |
| 2413 | laser_spotlight.Enabled = true | |
| 2414 | else | |
| 2415 | laser_spotlight.Enabled = false | |
| 2416 | end | |
| 2417 | end | |
| 2418 | end | |
| 2419 | end | |
| 2420 | end | |
| 2421 | function GraphicalEffects.ShootLaserOfDeath(target, data) | |
| 2422 | if chatAdornee then | |
| 2423 | data = data or {}
| |
| 2424 | local brickcolor = data.brickcolor or BrickColor.new("Really black")
| |
| 2425 | local duration = data.duration or 40 | |
| 2426 | local fragmentation_size = data.fragmentation_size or 3 | |
| 2427 | local laser_scale = data.laser_scale or 1 | |
| 2428 | local light_color = data.light_color or Color3.new(1, 0.5, 1) | |
| 2429 | local magic_circle_image = data.magic_circle_image or "rbxassetid://122610943" | |
| 2430 | local magic_circle_scale = data.magic_circle_scale or 1 | |
| 2431 | local sound_volume = data.sound_volume or 1 / 3 | |
| 2432 | local special_effects = data.special_effects | |
| 2433 | local stay = data.stay or 4 | |
| 2434 | local origin = chatAdornee.CFrame | |
| 2435 | local directionOrientation = origin:pointToObjectSpace(target) | |
| 2436 | local direction = (target - origin.p).unit | |
| 2437 | local magic_circle_position = origin.p + direction * GraphicalEffects.LASER_MAGIC_CIRCLE_DISTANCE | |
| 2438 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) | |
| 2439 | local magic_circle_model = Instance.new("Model")
| |
| 2440 | local laser_part = Instance.new("Part", magic_circle_model)
| |
| 2441 | local laser_mesh = Instance.new("CylinderMesh", laser_part)
| |
| 2442 | local magic_circle_part = Instance.new("Part", magic_circle_model)
| |
| 2443 | local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part)
| |
| 2444 | local magic_circle_light = Instance.new("PointLight", magic_circle_part)
| |
| 2445 | local magic_circle_decal_back = Instance.new("Decal", magic_circle_part)
| |
| 2446 | local magic_circle_decal_front = Instance.new("Decal", magic_circle_part)
| |
| 2447 | local sound = Instance.new("Sound", magic_circle_part)
| |
| 2448 | sound.Pitch = 1.25 | |
| 2449 | sound.SoundId = "rbxassetid://2248511" | |
| 2450 | sound.Volume = sound_volume | |
| 2451 | magic_circle_model.Archivable = false | |
| 2452 | laser_part.Anchored = true | |
| 2453 | laser_part.BottomSurface = "Smooth" | |
| 2454 | laser_part.BrickColor = brickcolor | |
| 2455 | laser_part.CanCollide = false | |
| 2456 | laser_part.CFrame = magic_circle_cframe * CFrame.Angles(-0.5 * math.pi, 0, 0) | |
| 2457 | laser_part.FormFactor = "Custom" | |
| 2458 | laser_part.Locked = true | |
| 2459 | laser_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 2460 | laser_part.TopSurface = "Smooth" | |
| 2461 | laser_mesh.Offset = Vector3.new(0, 0, 0) | |
| 2462 | laser_mesh.Name = "Mesh" | |
| 2463 | laser_mesh.Scale = 5 * laser_scale * Vector3.new(GraphicalEffects.LASER_WIDTH, 0, GraphicalEffects.LASER_WIDTH) | |
| 2464 | magic_circle_part.Anchored = true | |
| 2465 | magic_circle_part.BottomSurface = "Smooth" | |
| 2466 | magic_circle_part.CanCollide = false | |
| 2467 | magic_circle_part.CFrame = magic_circle_cframe | |
| 2468 | magic_circle_part.FormFactor = "Custom" | |
| 2469 | magic_circle_part.Locked = true | |
| 2470 | magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 2471 | magic_circle_part.TopSurface = "Smooth" | |
| 2472 | magic_circle_part.Transparency = 1 | |
| 2473 | magic_circle_mesh.Scale = Vector3.new(60, 60, 0) * magic_circle_scale | |
| 2474 | magic_circle_light.Color = light_color | |
| 2475 | magic_circle_light.Range = 16 * magic_circle_scale | |
| 2476 | magic_circle_light.Shadows = true | |
| 2477 | magic_circle_decal_back.Face = "Back" | |
| 2478 | magic_circle_decal_back.Texture = magic_circle_image | |
| 2479 | magic_circle_decal_front.Face = "Front" | |
| 2480 | magic_circle_decal_front.Texture = magic_circle_image | |
| 2481 | magic_circle_model.Parent = Workspace | |
| 2482 | local laser_color = brickcolor.Color | |
| 2483 | local laser_lights = {}
| |
| 2484 | local light_effects = laser_color.r + laser_color.g + laser_color.b > 0.25 | |
| 2485 | if light_effects then | |
| 2486 | local laser_spotlight_part_template = Instance.new("Part")
| |
| 2487 | local laser_spotlight_light_template = Instance.new("SpotLight", laser_spotlight_part_template)
| |
| 2488 | laser_spotlight_part_template.Anchored = true | |
| 2489 | laser_spotlight_part_template.Anchored = true | |
| 2490 | laser_spotlight_part_template.BottomSurface = "Smooth" | |
| 2491 | laser_spotlight_part_template.CanCollide = false | |
| 2492 | laser_spotlight_part_template.FormFactor = "Custom" | |
| 2493 | laser_spotlight_part_template.Locked = true | |
| 2494 | laser_spotlight_part_template.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 2495 | laser_spotlight_part_template.TopSurface = "Smooth" | |
| 2496 | laser_spotlight_part_template.Transparency = 1 | |
| 2497 | laser_spotlight_light_template.Angle = 45 | |
| 2498 | laser_spotlight_light_template.Color = laser_color | |
| 2499 | laser_spotlight_light_template.Enabled = true | |
| 2500 | laser_spotlight_light_template.Name = "Light" | |
| 2501 | laser_spotlight_light_template.Range = 60 | |
| 2502 | for index = 1, 40 do | |
| 2503 | local laser_spotlight_part = laser_spotlight_part_template:Clone() | |
| 2504 | laser_spotlight_part.CFrame = magic_circle_cframe * CFrame.new(0, 0, -30 * (index - 1)) | |
| 2505 | laser_spotlight_part.Parent = magic_circle_model | |
| 2506 | laser_lights[index] = {laser_spotlight_part, laser_spotlight_part.Light}
| |
| 2507 | end | |
| 2508 | end | |
| 2509 | local laser_effects | |
| 2510 | if special_effects then | |
| 2511 | laser_effects = {}
| |
| 2512 | local laser_effect_1 = laser_part:Clone() | |
| 2513 | laser_effect_1.BrickColor = special_effects | |
| 2514 | laser_effect_1.Transparency = 0.5 | |
| 2515 | local laser_effect_2 = laser_effect_1:Clone() | |
| 2516 | laser_effects[1], laser_effects[2] = {laser_effect_1, laser_effect_1.Mesh}, {laser_effect_2, laser_effect_2.Mesh}
| |
| 2517 | laser_effect_1.Parent = magic_circle_model | |
| 2518 | laser_effect_2.Parent = magic_circle_model | |
| 2519 | end | |
| 2520 | GraphicalEffects.laser_data[{0, directionOrientation, direction, magic_circle_model, laser_part, laser_mesh, magic_circle_part,
| |
| 2521 | ||
| 2522 | magic_circle_light, magic_circle_decal_back, magic_circle_decal_front, sound, laser_scale, fragmentation_size, duration, laser_lights, laser_effects, stay, | |
| 2523 | ||
| 2524 | light_effects}] = true | |
| 2525 | end | |
| 2526 | end | |
| 2527 | ||
| 2528 | function GraphicalEffects.SpawnSapientRock(position) | |
| 2529 | local part = Instance.new("Part", Workspace)
| |
| 2530 | local size = 8 + math.random(0, 5) | |
| 2531 | part.BottomSurface = "Smooth" | |
| 2532 | part.TopSurface = "Smooth" | |
| 2533 | part.Material = "Slate" | |
| 2534 | part.Locked = true | |
| 2535 | part.Shape = "Ball" | |
| 2536 | part.FormFactor = "Custom" | |
| 2537 | part.Size = Vector3.new(size, size, size) | |
| 2538 | part.Position = position | |
| 2539 | local bodypos = Instance.new("BodyPosition", part)
| |
| 2540 | bodypos.maxForce = Vector3.new(0, 0, 0) | |
| 2541 | local angry = false | |
| 2542 | local damage_ready = true | |
| 2543 | local torso_following | |
| 2544 | local torso_changed = -1000 | |
| 2545 | local touched_conn = part.Touched:connect(function(hit) | |
| 2546 | local character = hit.Parent | |
| 2547 | if character then | |
| 2548 | local humanoid | |
| 2549 | for _, child in ipairs(character:GetChildren()) do | |
| 2550 | if child:IsA("Humanoid") then
| |
| 2551 | humanoid = child | |
| 2552 | break | |
| 2553 | end | |
| 2554 | end | |
| 2555 | if humanoid then | |
| 2556 | if angry then | |
| 2557 | if damage_ready then | |
| 2558 | damage_ready = false | |
| 2559 | humanoid:TakeDamage(100) | |
| 2560 | wait(1) | |
| 2561 | damage_ready = true | |
| 2562 | angry = false | |
| 2563 | part.BrickColor = BrickColor.new("Medium stone grey")
| |
| 2564 | end | |
| 2565 | else | |
| 2566 | local torso = humanoid.Torso | |
| 2567 | if torso then | |
| 2568 | torso_following = torso | |
| 2569 | torso_changed = tick() | |
| 2570 | end | |
| 2571 | end | |
| 2572 | end | |
| 2573 | end | |
| 2574 | end) | |
| 2575 | TaskScheduler.Start(function() | |
| 2576 | while part.Parent == Workspace do | |
| 2577 | if torso_following then | |
| 2578 | bodypos.position = torso_following.Position | |
| 2579 | if tick() - torso_changed > 60 or not torso_following.Parent then | |
| 2580 | torso_following = nil | |
| 2581 | bodypos.maxForce = Vector3.new(0, 0, 0) | |
| 2582 | angry = false | |
| 2583 | part.BrickColor = BrickColor.new("Medium stone grey")
| |
| 2584 | else | |
| 2585 | local speed = angry and Vector3.new(16, 16, 16) or Vector3.new(6, 0, 6) | |
| 2586 | bodypos.maxForce = part:GetMass() * speed | |
| 2587 | if part.Position.Y < -250 then | |
| 2588 | part.Velocity = Vector3.new() | |
| 2589 | part.Position = torso_following.Position + Vector3.new(0, 80, 0) | |
| 2590 | part.BrickColor = BrickColor.new("Bright red")
| |
| 2591 | angry = true | |
| 2592 | torso_changed = tick() | |
| 2593 | end | |
| 2594 | end | |
| 2595 | end | |
| 2596 | RunService.Stepped:wait() | |
| 2597 | end | |
| 2598 | touched_conn:disconnect() | |
| 2599 | end) | |
| 2600 | TaskScheduler.Start(function() | |
| 2601 | while part.Parent == Workspace do | |
| 2602 | wait(25 + math.random() * 10) | |
| 2603 | local next_size = 8 + math.random() * 5 | |
| 2604 | if math.random(100) == 1 then | |
| 2605 | next_size = next_size * (2 + 6 * math.random()) | |
| 2606 | end | |
| 2607 | next_size = math.floor(next_size + 0.5) | |
| 2608 | local start_time = tick() | |
| 2609 | local mesh = Instance.new("SpecialMesh", part)
| |
| 2610 | mesh.MeshType = "Sphere" | |
| 2611 | repeat | |
| 2612 | local elapsed_time = tick() - start_time | |
| 2613 | local alpha = math.cos(elapsed_time * math.pi * 0.5) | |
| 2614 | local interpolated_size = size * alpha + next_size * (1 - alpha) | |
| 2615 | local size_vector = Vector3.new(interpolated_size, interpolated_size, interpolated_size) | |
| 2616 | local cframe = part.CFrame | |
| 2617 | part.Size = size_vector | |
| 2618 | part.CFrame = cframe | |
| 2619 | mesh.Scale = size_vector / part.Size | |
| 2620 | RunService.Stepped:wait() | |
| 2621 | until tick() - start_time >= 1 | |
| 2622 | mesh:Destroy() | |
| 2623 | local cframe = part.CFrame | |
| 2624 | part.Size = Vector3.new(next_size, next_size, next_size) | |
| 2625 | part.CFrame = cframe | |
| 2626 | size = next_size | |
| 2627 | end | |
| 2628 | end) | |
| 2629 | end | |
| 2630 | ||
| 2631 | function GraphicalEffects.MainLoop() | |
| 2632 | RunService.Stepped:wait() | |
| 2633 | for data in pairs(GraphicalEffects.magicCircleData) do | |
| 2634 | GraphicalEffects.AnimateMagicCircle(data) | |
| 2635 | end | |
| 2636 | for data in pairs(GraphicalEffects.laser_data) do | |
| 2637 | GraphicalEffects.AnimateLaserOfDeath(data) | |
| 2638 | end | |
| 2639 | for data in pairs(GraphicalEffects.missileData) do | |
| 2640 | GraphicalEffects.AnimateMissile(data) | |
| 2641 | end | |
| 2642 | end | |
| 2643 | TaskScheduler.Start(function() | |
| 2644 | while true do | |
| 2645 | GraphicalEffects.MainLoop() | |
| 2646 | end | |
| 2647 | end) | |
| 2648 | ||
| 2649 | PlayerControl = {};
| |
| 2650 | ||
| 2651 | PlayerControl.fly_acceleration = 10 | |
| 2652 | PlayerControl.fly_basespeed = 250 | |
| 2653 | PlayerControl.fly_speed = PlayerControl.fly_basespeed | |
| 2654 | PlayerControl.featherfallEnabled = true | |
| 2655 | PlayerControl.pushable = false | |
| 2656 | PlayerControl.rolling = false | |
| 2657 | PlayerControl.rollingAngle = 0 | |
| 2658 | PlayerControl.rollingOffset = 0 | |
| 2659 | PlayerControl.rollingMaxOffset = 3 | |
| 2660 | PlayerControl.rollingSpeed = 1 / 50 | |
| 2661 | PlayerControl.characterEnabled = false | |
| 2662 | PlayerControl.characterMode = "normal" | |
| 2663 | local character = nil | |
| 2664 | local flying, flyingMomentum, flyingTilt = false, Vector3.new(), 0 | |
| 2665 | local pose, regeneratingHealth, jumpDebounce = "Standing", false, false | |
| 2666 | -- TODO: make local variables public | |
| 2667 | local model, bodyColors, leftArmMesh, leftLegMesh, rightArmMesh, rightLegMesh, torsoMesh, wildcardHat, wildcardHandle, wildcardMesh, pants, shirt, humanoid, | |
| 2668 | ||
| 2669 | head, leftArm, leftLeg, rightArm, rightLeg, torso, rootPart, rootJoint, face, soundFreeFalling, soundGettingUp, soundRunning, leftHip, leftShoulder, | |
| 2670 | ||
| 2671 | rightHip, rightShoulder, neck, wildcardWeld, feetPart, feetWeld, feetTouchInterest, bodyGyro, bodyVelocity, headMesh, torsoLight | |
| 2672 | local AnimateCharacter | |
| 2673 | local UserInterface = game:service'UserInputService' | |
| 2674 | local chatBubbles = {}
| |
| 2675 | local chatCharacterLimit = 240 | |
| 2676 | function PlayerControl.CreateCharacter() | |
| 2677 | local characterMode = PlayerControl.characterMode | |
| 2678 | if characterMode == "normal" then | |
| 2679 | if not PlayerControl.characterEnabled then | |
| 2680 | return | |
| 2681 | end | |
| 2682 | local appearance = CharacterAppearance.GetDefaultAppearance() | |
| 2683 | local active = true | |
| 2684 | local torsoCFrame = (torso and torso.CFrame) or PlayerControl.torso_cframe or CFrame.new(0, 10, 0) | |
| 2685 | if torsoCFrame.p.Y < -450 then | |
| 2686 | torsoCFrame = CFrame.new(0, 10, 0) | |
| 2687 | end | |
| 2688 | local rootPartCFrame = (rootPart and rootPart.CFrame) or PlayerControl.torso_cframe or CFrame.new(0, 10, 0) | |
| 2689 | if rootPartCFrame.p.Y < -450 then | |
| 2690 | rootPartCFrame = CFrame.new(0, 10, 0) | |
| 2691 | end | |
| 2692 | local cameraCFrame = Camera.CoordinateFrame | |
| 2693 | local connections = {}
| |
| 2694 | local feetTouching = {}
| |
| 2695 | local previousWalkSpeed = 0 | |
| 2696 | local prevLeftHip, prevLeftShoulder, prevRightHip, prevRightShoulder = leftHip, leftShoulder, rightHip, rightShoulder | |
| 2697 | model = Instance.new("Model")
| |
| 2698 | humanoid = Instance.new("Humanoid", model)
| |
| 2699 | head = Instance.new("Part", model)
| |
| 2700 | leftArm = Instance.new("Part", model)
| |
| 2701 | leftLeg = Instance.new("Part", model)
| |
| 2702 | rightArm = Instance.new("Part", model)
| |
| 2703 | rightLeg = Instance.new("Part", model)
| |
| 2704 | torso = Instance.new("Part", model)
| |
| 2705 | rootPart = Instance.new("Part", model)
| |
| 2706 | soundFallingDown = Instance.new("Sound", head)
| |
| 2707 | soundFreeFalling = Instance.new("Sound", head)
| |
| 2708 | soundGettingUp = Instance.new("Sound", head)
| |
| 2709 | soundJumping = Instance.new("Sound", head)
| |
| 2710 | soundRunning = Instance.new("Sound", head)
| |
| 2711 | leftHip = Instance.new("Motor", torso)
| |
| 2712 | leftShoulder = Instance.new("Motor", torso)
| |
| 2713 | rightHip = Instance.new("Motor", torso)
| |
| 2714 | rightShoulder = Instance.new("Motor", torso)
| |
| 2715 | neck = Instance.new("Motor", torso)
| |
| 2716 | rootJoint = Instance.new("Motor", rootPart)
| |
| 2717 | feetPart = Instance.new("Part", model)
| |
| 2718 | feetWeld = Instance.new("Weld", torso)
| |
| 2719 | bodyGyro = Instance.new("BodyGyro", rootPart)
| |
| 2720 | bodyVelocity = Instance.new("BodyVelocity", rootPart)
| |
| 2721 | model.Archivable = false | |
| 2722 | model.Name = user_name or Player.Name | |
| 2723 | model.PrimaryPart = head | |
| 2724 | humanoid.LeftLeg = leftLeg | |
| 2725 | humanoid.RightLeg = rightLeg | |
| 2726 | humanoid.Torso = rootPart | |
| 2727 | head.CFrame = torsoCFrame * CFrame.new(0, 1.5, 0) | |
| 2728 | head.FormFactor = "Symmetric" | |
| 2729 | head.Locked = true | |
| 2730 | head.Name = "Head" | |
| 2731 | head.Size = Vector3.new(2, 1, 1) | |
| 2732 | head.TopSurface = "Smooth" | |
| 2733 | leftArm.CanCollide = false | |
| 2734 | leftArm.CFrame = torsoCFrame * CFrame.new(-1.5, 0, 0) | |
| 2735 | leftArm.FormFactor = "Symmetric" | |
| 2736 | leftArm.Locked = true | |
| 2737 | leftArm.Name = "Left Arm" | |
| 2738 | leftArm.Size = Vector3.new(1, 2, 1) | |
| 2739 | leftLeg.BottomSurface = "Smooth" | |
| 2740 | leftLeg.CanCollide = false | |
| 2741 | leftLeg.CFrame = torsoCFrame * CFrame.new(-0.5, -2, 0) | |
| 2742 | leftLeg.FormFactor = "Symmetric" | |
| 2743 | leftLeg.Locked = true | |
| 2744 | leftLeg.Name = "Left Leg" | |
| 2745 | leftLeg.Size = Vector3.new(1, 2, 1) | |
| 2746 | leftLeg.TopSurface = "Smooth" | |
| 2747 | rightArm.CanCollide = false | |
| 2748 | rightArm.CFrame = torsoCFrame * CFrame.new(1.5, 0, 0) | |
| 2749 | rightArm.FormFactor = "Symmetric" | |
| 2750 | rightArm.Locked = true | |
| 2751 | rightArm.Name = "Right Arm" | |
| 2752 | rightArm.Size = Vector3.new(1, 2, 1) | |
| 2753 | rightLeg.BottomSurface = "Smooth" | |
| 2754 | rightLeg.CanCollide = false | |
| 2755 | rightLeg.CFrame = torsoCFrame * CFrame.new(0.5, -2, 0) | |
| 2756 | rightLeg.FormFactor = "Symmetric" | |
| 2757 | rightLeg.Locked = true | |
| 2758 | rightLeg.Name = "Right Leg" | |
| 2759 | rightLeg.Size = Vector3.new(1, 2, 1) | |
| 2760 | rightLeg.TopSurface = "Smooth" | |
| 2761 | torso.CFrame = torsoCFrame | |
| 2762 | torso.FormFactor = "Symmetric" | |
| 2763 | torso.LeftSurface = "Weld" | |
| 2764 | torso.Locked = true | |
| 2765 | torso.RightSurface = "Weld" | |
| 2766 | torso.Name = "Torso" | |
| 2767 | torso.Size = Vector3.new(2, 2, 1) | |
| 2768 | rootPart.BottomSurface = "Smooth" | |
| 2769 | rootPart.BrickColor = BrickColor.Blue() | |
| 2770 | rootPart.CFrame = rootPartCFrame | |
| 2771 | rootPart.FormFactor = "Symmetric" | |
| 2772 | rootPart.LeftSurface = "Weld" | |
| 2773 | rootPart.Locked = true | |
| 2774 | rootPart.RightSurface = "Weld" | |
| 2775 | rootPart.Name = "HumanoidRootPart" | |
| 2776 | rootPart.Size = Vector3.new(2, 2, 1) | |
| 2777 | rootPart.TopSurface = "Smooth" | |
| 2778 | rootPart.Transparency = 1 | |
| 2779 | soundFreeFalling.Archivable = false | |
| 2780 | soundFreeFalling.SoundId = "rbxasset://sounds/swoosh.wav" | |
| 2781 | soundGettingUp.Archivable = false | |
| 2782 | soundGettingUp.SoundId = "rbxasset://sounds/hit.wav" | |
| 2783 | soundRunning.Archivable = false | |
| 2784 | soundRunning.SoundId = "rbxasset://sounds/bfsl-minifigfoots1.mp3" | |
| 2785 | soundRunning.Looped = true | |
| 2786 | leftHip.C0 = CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 2787 | leftHip.C1 = CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 2788 | leftHip.MaxVelocity = 0.1 | |
| 2789 | leftHip.Name = "Left Hip" | |
| 2790 | leftHip.Part0 = torso | |
| 2791 | leftHip.Part1 = leftLeg | |
| 2792 | leftShoulder.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 2793 | leftShoulder.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0) | |
| 2794 | leftShoulder.MaxVelocity = 0.15 | |
| 2795 | leftShoulder.Name = "Left Shoulder" | |
| 2796 | leftShoulder.Part0 = torso | |
| 2797 | leftShoulder.Part1 = leftArm | |
| 2798 | rightHip.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 2799 | rightHip.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 2800 | rightHip.MaxVelocity = 0.1 | |
| 2801 | rightHip.Name = "Right Hip" | |
| 2802 | rightHip.Part0 = torso | |
| 2803 | rightHip.Part1 = rightLeg | |
| 2804 | rightShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 2805 | rightShoulder.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0) | |
| 2806 | rightShoulder.MaxVelocity = 0.15 | |
| 2807 | rightShoulder.Name = "Right Shoulder" | |
| 2808 | rightShoulder.Part0 = torso | |
| 2809 | rightShoulder.Part1 = rightArm | |
| 2810 | if prevLeftHip then | |
| 2811 | leftHip.CurrentAngle = prevLeftHip.CurrentAngle | |
| 2812 | leftHip.DesiredAngle = prevLeftHip.DesiredAngle | |
| 2813 | end | |
| 2814 | if prevLeftShoulder then | |
| 2815 | leftShoulder.CurrentAngle = prevLeftShoulder.CurrentAngle | |
| 2816 | leftShoulder.DesiredAngle = prevLeftShoulder.DesiredAngle | |
| 2817 | end | |
| 2818 | if prevRightHip then | |
| 2819 | rightHip.CurrentAngle = prevRightHip.CurrentAngle | |
| 2820 | rightHip.DesiredAngle = prevRightHip.DesiredAngle | |
| 2821 | end | |
| 2822 | if prevRightShoulder then | |
| 2823 | rightShoulder.CurrentAngle = prevRightShoulder.CurrentAngle | |
| 2824 | rightShoulder.DesiredAngle = prevRightShoulder.DesiredAngle | |
| 2825 | end | |
| 2826 | neck.C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
| 2827 | neck.C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0) | |
| 2828 | neck.Name = "Neck" | |
| 2829 | neck.Part0 = torso | |
| 2830 | neck.Part1 = head | |
| 2831 | rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) | |
| 2832 | rootJoint.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) | |
| 2833 | rootJoint.Name = "RootJoint" | |
| 2834 | rootJoint.Part0 = rootPart | |
| 2835 | rootJoint.Part1 = torso | |
| 2836 | feetPart.BottomSurface = "Smooth" | |
| 2837 | feetPart.CanCollide = false | |
| 2838 | feetPart.CFrame = torsoCFrame * CFrame.new(0, -3.1, 0) | |
| 2839 | feetPart.FormFactor = "Custom" | |
| 2840 | feetPart.Locked = true | |
| 2841 | feetPart.Name = "Platform" | |
| 2842 | feetPart.Size = Vector3.new(1.8, 0.2, 0.8) | |
| 2843 | feetPart.TopSurface = "Smooth" | |
| 2844 | feetPart.Transparency = 1 | |
| 2845 | feetWeld.C0 = CFrame.new(0, -3, 0) | |
| 2846 | feetWeld.C1 = CFrame.new(0, 0.1, 0) | |
| 2847 | feetWeld.Name = "PlatformWeld" | |
| 2848 | feetWeld.Part0 = torso | |
| 2849 | feetWeld.Part1 = feetPart | |
| 2850 | table.insert(connections, feetPart.Touched:connect(function(hit) | |
| 2851 | feetTouching[hit] = true | |
| 2852 | end)) | |
| 2853 | table.insert(connections, feetPart.TouchEnded:connect(function(hit) | |
| 2854 | feetTouching[hit] = nil | |
| 2855 | end)) | |
| 2856 | feetTouchInterest = feetPart:FindFirstChild("TouchInterest")
| |
| 2857 | bodyGyro.D = 3250 | |
| 2858 | bodyGyro.P = 400000 | |
| 2859 | bodyGyro.maxTorque = Vector3.new(1000000000, 0, 1000000000) | |
| 2860 | bodyVelocity.P = 5000 | |
| 2861 | bodyVelocity.maxForce = Vector3.new(0, 0, 0) | |
| 2862 | bodyVelocity.velocity = Vector3.new(0, 0, 0) | |
| 2863 | torsoLight = Instance.new("PointLight", torso)
| |
| 2864 | torsoLight.Brightness = 0.4 | |
| 2865 | torsoLight.Color = Color3.new(1, 1, 1) | |
| 2866 | torsoLight.Range = 16 | |
| 2867 | torsoLight.Shadows = true | |
| 2868 | local ff1, ff2, ff3, ff4, ff5, ff6, ff7, ff8, ff9 = Instance.new("ForceField", head), Instance.new("ForceField", leftArm), Instance.new("ForceField", leftLeg), Instance.new("ForceField", rightArm), Instance.new("ForceField", rightLeg), Instance.new("ForceField", torso), Instance.new("ForceField", wildcardHandle), Instance.new("ForceField", feetPart), Instance.new("ForceField", rootPart)
| |
| 2869 | local forcefields = {[ff1] = head, [ff2] = leftArm, [ff3] = leftLeg, [ff4] = rightArm, [ff5] = rightLeg, [ff6] = torso, [ff7] = wildcardHandle, [ff8] = feetPart, [ff9] = rootPart}
| |
| 2870 | local objects = {[humanoid] = true, [head] = true, [leftArm] = true, [leftLeg] = true, [rightArm] = true, [rightLeg] = true, [torso] = true, [rootPart] = true, [rootJoint] = true, [soundFreeFalling] = true, [soundGettingUp] = true, [soundRunning] = true, [leftHip] = true, [leftShoulder] = true, [rightHip] = true, [rightShoulder] = true, [neck] = true, [feetPart] = true, [feetWeld] = true, [feetTouchInterest] = true, [bodyGyro] = true, [bodyVelocity] = true, [ff1] = true, [ff2] = true, [ff3] = true, [ff4] = true, [ff5] = true, [ff6] = true, [ff7] = true, [ff8] = true, [ff9] = true}
| |
| 2871 | local tshirtUrl = appearance.tshirt | |
| 2872 | if tshirtUrl then | |
| 2873 | local tshirt = Instance.new("Decal", torso)
| |
| 2874 | tshirt.Name = "roblox" | |
| 2875 | tshirt.Texture = tshirtUrl | |
| 2876 | objects[tshirt] = true | |
| 2877 | end | |
| 2878 | for _, template in ipairs(appearance.characterObjects) do | |
| 2879 | local object = template:Clone() | |
| 2880 | local newObjects = {object}
| |
| 2881 | for _, object in ipairs(newObjects) do | |
| 2882 | objects[object] = true | |
| 2883 | for _, child in ipairs(object:GetChildren()) do | |
| 2884 | table.insert(newObjects, child) | |
| 2885 | end | |
| 2886 | end | |
| 2887 | if object:IsA("BodyColors") then
| |
| 2888 | head.BrickColor = object.HeadColor | |
| 2889 | leftArm.BrickColor = object.LeftArmColor | |
| 2890 | leftLeg.BrickColor = object.LeftLegColor | |
| 2891 | rightArm.BrickColor = object.RightArmColor | |
| 2892 | rightLeg.BrickColor = object.RightLegColor | |
| 2893 | torso.BrickColor = object.TorsoColor | |
| 2894 | elseif object:IsA("Hat") then
| |
| 2895 | local handle = object:FindFirstChild("Handle")
| |
| 2896 | if handle and handle:IsA("BasePart") then
| |
| 2897 | local weld = Instance.new("Weld", head)
| |
| 2898 | weld.C0 = CFrame.new(0, 0.5, 0) | |
| 2899 | local attachmentPos = object.AttachmentPos | |
| 2900 | local attachmentRight = object.AttachmentRight | |
| 2901 | local attachmentUp = object.AttachmentUp | |
| 2902 | local attachmentForward = object.AttachmentForward | |
| 2903 | weld.C1 = CFrame.new(attachmentPos.X, attachmentPos.Y, attachmentPos.Z, | |
| 2904 | attachmentRight.X, attachmentUp.X, -attachmentForward.X, | |
| 2905 | attachmentRight.Y, attachmentUp.Y, -attachmentForward.Y, | |
| 2906 | attachmentRight.Z, attachmentUp.Z, -attachmentForward.Z) | |
| 2907 | weld.Name = "HeadWeld" | |
| 2908 | weld.Part0 = head | |
| 2909 | weld.Part1 = handle | |
| 2910 | handle.Parent = model | |
| 2911 | local antiGravity = Instance.new("BodyForce", handle)
| |
| 2912 | antiGravity.force = Vector3.new(0, handle:GetMass() * 196.2, 0) | |
| 2913 | objects[object] = false | |
| 2914 | object.Parent = nil | |
| 2915 | objects[weld] = true | |
| 2916 | end | |
| 2917 | end | |
| 2918 | object.Parent = model | |
| 2919 | end | |
| 2920 | local facePresent = false | |
| 2921 | local headMeshPresent = false | |
| 2922 | for _, template in ipairs(appearance.headObjects) do | |
| 2923 | local object = template:Clone() | |
| 2924 | local newObjects = {object}
| |
| 2925 | for _, object in ipairs(newObjects) do | |
| 2926 | objects[object] = true | |
| 2927 | for _, child in ipairs(object:GetChildren()) do | |
| 2928 | table.insert(newObjects, child) | |
| 2929 | end | |
| 2930 | end | |
| 2931 | if object:IsA("DataModelMesh") then
| |
| 2932 | headMeshPresent = true | |
| 2933 | elseif object:IsA("Decal") then
| |
| 2934 | facePresent = true | |
| 2935 | end | |
| 2936 | object.Parent = head | |
| 2937 | end | |
| 2938 | if not facePresent then | |
| 2939 | local face = Instance.new("Decal", head)
| |
| 2940 | face.Texture = "rbxasset://textures/face.png" | |
| 2941 | objects[face] = true | |
| 2942 | end | |
| 2943 | if not headMeshPresent then | |
| 2944 | local headMesh = Instance.new("SpecialMesh", head)
| |
| 2945 | headMesh.Scale = Vector3.new(1.25, 1.25, 1.25) | |
| 2946 | objects[headMesh] = true | |
| 2947 | end | |
| 2948 | table.insert(connections, model.DescendantAdded:connect(function(object) | |
| 2949 | local success, is_localscript = pcall(Game.IsA, object, "LocalScript") | |
| 2950 | if success and is_localscript then | |
| 2951 | pcall(Utility.SetProperty, object, "Disabled", true) | |
| 2952 | local changed_connection = pcall(object.Changed.connect, object.Changed, function(property) | |
| 2953 | if property == "Disabled" and not object.Disabled then | |
| 2954 | pcall(Utility.SetProperty, object, "Disabled", true) | |
| 2955 | object:Destroy() | |
| 2956 | end | |
| 2957 | end) | |
| 2958 | end | |
| 2959 | if not objects[object] then | |
| 2960 | object:Destroy() | |
| 2961 | end | |
| 2962 | end)) | |
| 2963 | model.Parent = Workspace | |
| 2964 | Player.Character = model | |
| 2965 | Camera.CameraSubject = humanoid | |
| 2966 | Camera.CameraType = "Track" | |
| 2967 | Camera.CoordinateFrame = cameraCFrame | |
| 2968 | local IsStanding | |
| 2969 | local RegenerateHealth | |
| 2970 | local ResetCharacter | |
| 2971 | function IsStanding() | |
| 2972 | return not not next(feetTouching) | |
| 2973 | end | |
| 2974 | function RegenerateHealth() | |
| 2975 | if humanoid.Health < 1 then | |
| 2976 | humanoid.Health = 100 | |
| 2977 | elseif not regeneratingHealth then | |
| 2978 | regeneratingHealth = true | |
| 2979 | local elapsedTime = wait(1) | |
| 2980 | regeneratingHealth = false | |
| 2981 | if humanoid.Health < 100 then | |
| 2982 | humanoid.Health = math.min(humanoid.Health + elapsedTime, 100) | |
| 2983 | end | |
| 2984 | end | |
| 2985 | end | |
| 2986 | function ResetCharacter() | |
| 2987 | for index, connection in ipairs(connections) do | |
| 2988 | connection:disconnect() | |
| 2989 | end | |
| 2990 | active = false | |
| 2991 | end | |
| 2992 | table.insert(connections, model.AncestryChanged:connect(ResetCharacter)) | |
| 2993 | table.insert(connections, model.DescendantRemoving:connect(function(object) | |
| 2994 | local parent = forcefields[object] | |
| 2995 | if parent then | |
| 2996 | forcefields[object] = nil | |
| 2997 | local new_forcefield = Instance.new("ForceField")
| |
| 2998 | forcefields[new_forcefield] = parent | |
| 2999 | objects[new_forcefield] = true | |
| 3000 | new_forcefield.Parent = parent | |
| 3001 | elseif objects[object] then | |
| 3002 | ResetCharacter() | |
| 3003 | end | |
| 3004 | end)) | |
| 3005 | table.insert(connections, humanoid.HealthChanged:connect(RegenerateHealth)) | |
| 3006 | table.insert(connections, humanoid.Climbing:connect(function() pose = "Climbing" end)) | |
| 3007 | table.insert(connections, humanoid.FallingDown:connect(function(state) pose = "FallingDown" end)) | |
| 3008 | table.insert(connections, humanoid.FreeFalling:connect(function(state) pose = "FreeFall" if state then soundFreeFalling:Play() else | |
| 3009 | ||
| 3010 | soundFreeFalling:Pause() end end)) | |
| 3011 | table.insert(connections, humanoid.GettingUp:connect(function(state) pose = "GettingUp" if state then soundGettingUp:Play() else | |
| 3012 | ||
| 3013 | soundGettingUp:Pause() end end)) | |
| 3014 | table.insert(connections, humanoid.PlatformStanding:connect(function() pose = "PlatformStanding" end)) | |
| 3015 | table.insert(connections, humanoid.Seated:connect(function() pose = "Seated" end)) | |
| 3016 | table.insert(connections, humanoid.Swimming:connect(function(speed) if speed > 0 then pose = "Swimming" else pose = "Standing" end end)) | |
| 3017 | local previousRootPartCFrame = rootPart.CFrame | |
| 3018 | TaskScheduler.Start(function() | |
| 3019 | while active do | |
| 3020 | local totalTime = TaskScheduler.GetCurrentTime() | |
| 3021 | local stepTime = 1 / 60 | |
| 3022 | if not PlayerControl.characterEnabled then | |
| 3023 | ResetCharacter() | |
| 3024 | break | |
| 3025 | end | |
| 3026 | torsoLight.Brightness = 0.5 + 0.15 * math.sin(totalTime * 0.75 * math.pi) | |
| 3027 | local featherfallEnabled = PlayerControl.IsFeatherfallEnabled() | |
| 3028 | local rootPartCFrame = rootPart.CFrame | |
| 3029 | if not jumpDebounce and UserInterface:IsKeyDown(Enum.KeyCode.Space) then | |
| 3030 | if humanoid.Sit then | |
| 3031 | humanoid.Sit = false | |
| 3032 | end | |
| 3033 | if IsStanding() then | |
| 3034 | jumpDebounce = true | |
| 3035 | pose = "Jumping" | |
| 3036 | rootPart.Velocity = Vector3.new(rootPart.Velocity.X, 50, rootPart.Velocity.Z) | |
| 3037 | torso.Velocity = Vector3.new(torso.Velocity.X, 50, torso.Velocity.Z) | |
| 3038 | TaskScheduler.Schedule(1, function() | |
| 3039 | if pose == "Jumping" then | |
| 3040 | pose = "FreeFall" | |
| 3041 | end | |
| 3042 | jumpDebounce = false | |
| 3043 | humanoid.Jump = false | |
| 3044 | end) | |
| 3045 | end | |
| 3046 | end | |
| 3047 | local cameraCFrame = Camera.CoordinateFrame | |
| 3048 | local cameraDirection = cameraCFrame.lookVector | |
| 3049 | if flying then | |
| 3050 | if PlayerControl.rolling then | |
| 3051 | local rootPartCFrame = rootPart.CFrame | |
| 3052 | local speed = (rootPartCFrame - rootPartCFrame.p):pointToObjectSpace(rootPart.Velocity).Y | |
| 3053 | local decay = 0.5 ^ stepTime | |
| 3054 | if math.abs(speed) <= 50 then | |
| 3055 | PlayerControl.rollingAngle = (((PlayerControl.rollingAngle + 0.5) % 1 - 0.5) * decay) % 1 | |
| 3056 | PlayerControl.rollingOffset = PlayerControl.rollingOffset * decay | |
| 3057 | else | |
| 3058 | PlayerControl.rollingAngle = (PlayerControl.rollingAngle + stepTime * speed * PlayerControl.rollingSpeed) % 1 | |
| 3059 | PlayerControl.rollingOffset = (PlayerControl.rollingOffset + PlayerControl.rollingMaxOffset * (1 / decay - 1)) * decay | |
| 3060 | end | |
| 3061 | rootJoint.C0 = (CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) * CFrame.Angles(PlayerControl.rollingAngle * 2 * math.pi, 0, 0)) * CFrame.new(0, -PlayerControl.rollingOffset, 0) | |
| 3062 | else | |
| 3063 | rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) | |
| 3064 | PlayerControl.rollingAngle = 0 | |
| 3065 | PlayerControl.rollingOffset = 0 | |
| 3066 | end | |
| 3067 | rightShoulder.MaxVelocity = 0.5 | |
| 3068 | leftShoulder.MaxVelocity = 0.5 | |
| 3069 | rightShoulder.DesiredAngle = 0 | |
| 3070 | leftShoulder.DesiredAngle = 0 | |
| 3071 | rightHip.DesiredAngle = 0 | |
| 3072 | leftHip.DesiredAngle = 0 | |
| 3073 | bodyGyro.D = 500 | |
| 3074 | bodyGyro.P = 1e6 | |
| 3075 | bodyGyro.maxTorque = Vector3.new(1e6, 1e6, 1e6) | |
| 3076 | bodyVelocity.P = 1250 | |
| 3077 | bodyVelocity.maxForce = Vector3.new(1e6, 1e6, 1e6) | |
| 3078 | local movementRight = 0 | |
| 3079 | local movementForward = 0 | |
| 3080 | local movementUp = 0 | |
| 3081 | if UserInterface:IsKeyDown(Enum.KeyCode.A) and not UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
| 3082 | movementRight = -1 | |
| 3083 | elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
| 3084 | movementRight = 1 | |
| 3085 | end | |
| 3086 | if UserInterface:IsKeyDown(Enum.KeyCode.W) then | |
| 3087 | movementUp = 0.2 | |
| 3088 | if not UserInterface:IsKeyDown(Enum.KeyCode.S) then | |
| 3089 | movementForward = -1 | |
| 3090 | end | |
| 3091 | elseif UserInterface:IsKeyDown(Enum.KeyCode.S) then | |
| 3092 | movementForward = 1 | |
| 3093 | end | |
| 3094 | local movement = PlayerControl.fly_acceleration * cameraCFrame:vectorToWorldSpace(Vector3.new(movementRight, movementUp, movementForward)) | |
| 3095 | local previousMomentum = flyingMomentum | |
| 3096 | local previousTilt = flyingTilt | |
| 3097 | flyingMomentum = movement + flyingMomentum * (1 - PlayerControl.fly_acceleration / PlayerControl.fly_speed) | |
| 3098 | flyingTilt = ((flyingMomentum * Vector3.new(1, 0, 1)).unit:Cross((previousMomentum * Vector3.new(1, 0, 1)).unit)).Y | |
| 3099 | if flyingTilt ~= flyingTilt or flyingTilt == math.huge then | |
| 3100 | flyingTilt = 0 | |
| 3101 | end | |
| 3102 | local absoluteTilt = math.abs(flyingTilt) | |
| 3103 | if absoluteTilt > 0.06 or absoluteTilt < 0.0001 then | |
| 3104 | if math.abs(previousTilt) > 0.0001 then | |
| 3105 | flyingTilt = previousTilt * 0.9 | |
| 3106 | else | |
| 3107 | flyingTilt = 0 | |
| 3108 | end | |
| 3109 | else | |
| 3110 | flyingTilt = previousTilt * 0.77 + flyingTilt * 0.25 | |
| 3111 | end | |
| 3112 | previousTilt = flyingTilt | |
| 3113 | if flyingMomentum.magnitude < 0.1 then | |
| 3114 | flyingMomentum = Vector3.new(0, 0, 0) | |
| 3115 | -- bodyGyro.cframe = cameraCFrame | |
| 3116 | else | |
| 3117 | local momentumOrientation = CFrame.new(Vector3.new(0, 0, 0), flyingMomentum) | |
| 3118 | local tiltOrientation = CFrame.Angles(0, 0, -20 * flyingTilt) | |
| 3119 | bodyGyro.cframe = momentumOrientation * tiltOrientation * CFrame.Angles(-0.5 * math.pi * math.min(flyingMomentum.magnitude / PlayerControl.fly_speed, 1), 0, 0) | |
| 3120 | end | |
| 3121 | bodyVelocity.velocity = flyingMomentum + Vector3.new(0, 0.15695775618683547, 0) | |
| 3122 | rootPart.Velocity = flyingMomentum | |
| 3123 | previousMomentum = flyingMomentum | |
| 3124 | else | |
| 3125 | rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) | |
| 3126 | PlayerControl.rollingAngle = 0 | |
| 3127 | PlayerControl.rollingOffset = 0 | |
| 3128 | bodyGyro.D = 3250 | |
| 3129 | bodyGyro.P = 400000 | |
| 3130 | bodyVelocity.P = 5000 | |
| 3131 | local cameraDirection = cameraCFrame.lookVector | |
| 3132 | local walkDirection = Vector3.new(0, 0, 0) | |
| 3133 | local walkSpeed = 16 | |
| 3134 | if UserInterface:IsKeyDown(Enum.KeyCode.W) then | |
| 3135 | if UserInterface:IsKeyDown(Enum.KeyCode.A) then | |
| 3136 | walkDirection = Vector3.new(cameraDirection.X + cameraDirection.Z, 0, cameraDirection.Z - cameraDirection.X).unit | |
| 3137 | elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
| 3138 | walkDirection = Vector3.new(cameraDirection.X - cameraDirection.Z, 0, cameraDirection.Z + cameraDirection.X).unit | |
| 3139 | else | |
| 3140 | walkDirection = Vector3.new(cameraDirection.X, 0, cameraDirection.Z).unit | |
| 3141 | end | |
| 3142 | elseif UserInterface:IsKeyDown(Enum.KeyCode.S) then | |
| 3143 | if UserInterface:IsKeyDown(Enum.KeyCode.A) then | |
| 3144 | walkDirection = Vector3.new(-cameraDirection.X + cameraDirection.Z, 0, -cameraDirection.Z - cameraDirection.X).unit | |
| 3145 | elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
| 3146 | walkDirection = Vector3.new(-cameraDirection.X - cameraDirection.Z, 0, -cameraDirection.Z + cameraDirection.X).unit | |
| 3147 | else | |
| 3148 | walkDirection = Vector3.new(-cameraDirection.X, 0, -cameraDirection.Z).unit | |
| 3149 | end | |
| 3150 | elseif UserInterface:IsKeyDown(Enum.KeyCode.A) then | |
| 3151 | walkDirection = Vector3.new(cameraDirection.Z, 0, -cameraDirection.X).unit | |
| 3152 | elseif UserInterface:IsKeyDown(Enum.KeyCode.D) then | |
| 3153 | walkDirection = Vector3.new(-cameraDirection.Z, 0, cameraDirection.X).unit | |
| 3154 | else | |
| 3155 | walkSpeed = 0 | |
| 3156 | end | |
| 3157 | if walkSpeed ~= previousWalkSpeed then | |
| 3158 | if walkSpeed > 0 then | |
| 3159 | soundRunning:Play() | |
| 3160 | else | |
| 3161 | soundRunning:Pause() | |
| 3162 | end | |
| 3163 | end | |
| 3164 | if walkSpeed > 0 then | |
| 3165 | if pose ~= "Jumping" then | |
| 3166 | if IsStanding() then | |
| 3167 | pose = "Running" | |
| 3168 | else | |
| 3169 | pose = "FreeFall" | |
| 3170 | end | |
| 3171 | end | |
| 3172 | bodyGyro.cframe = CFrame.new(Vector3.new(), walkDirection) | |
| 3173 | bodyGyro.maxTorque = Vector3.new(1000000000, 1000000000, 1000000000) | |
| 3174 | bodyVelocity.maxForce = Vector3.new(1000000, maxForceY, 1000000) | |
| 3175 | else | |
| 3176 | if pose ~= "Jumping" then | |
| 3177 | if IsStanding() then | |
| 3178 | pose = "Standing" | |
| 3179 | else | |
| 3180 | pose = "FreeFall" | |
| 3181 | end | |
| 3182 | end | |
| 3183 | -- TODO: find and fix bug that causes torso to rotate back to some angle | |
| 3184 | bodyGyro.maxTorque = Vector3.new(1000000000, 1000000000, 1000000000) -- Vector3.new(1000000000, 0, 1000000000) | |
| 3185 | if PlayerControl.pushable then | |
| 3186 | bodyVelocity.maxForce = Vector3.new(0, 0, 0) | |
| 3187 | else | |
| 3188 | bodyVelocity.maxForce = Vector3.new(1000000, 0, 1000000) | |
| 3189 | end | |
| 3190 | end | |
| 3191 | if featherfallEnabled then | |
| 3192 | local velocity = rootPart.Velocity | |
| 3193 | if velocity.Y > 50 then | |
| 3194 | rootPart.Velocity = Vector3.new(velocity.X, 50, velocity.Z) | |
| 3195 | elseif velocity.Y < -50 then | |
| 3196 | rootPart.Velocity = Vector3.new(velocity.X, -50, velocity.Z) | |
| 3197 | end | |
| 3198 | local distanceVector = rootPartCFrame.p - previousRootPartCFrame.p | |
| 3199 | local offsetX, offsetY, offsetZ = distanceVector.X, distanceVector.Y, distanceVector.Z | |
| 3200 | local MAX_MOVEMENT = 50 * 0.03333333507180214 | |
| 3201 | if offsetX > MAX_MOVEMENT then | |
| 3202 | offsetX = MAX_MOVEMENT | |
| 3203 | elseif offsetX < -MAX_MOVEMENT then | |
| 3204 | offsetX = -MAX_MOVEMENT | |
| 3205 | end | |
| 3206 | if offsetY > MAX_MOVEMENT then | |
| 3207 | offsetY = MAX_MOVEMENT | |
| 3208 | elseif offsetY < -MAX_MOVEMENT then | |
| 3209 | offsetY = -MAX_MOVEMENT | |
| 3210 | end | |
| 3211 | if offsetZ > MAX_MOVEMENT then | |
| 3212 | offsetZ = MAX_MOVEMENT | |
| 3213 | elseif offsetZ < -MAX_MOVEMENT then | |
| 3214 | offsetZ = -MAX_MOVEMENT | |
| 3215 | end | |
| 3216 | local offset = Vector3.new(offsetX, offsetY, offsetZ) | |
| 3217 | if offset ~= distanceVector then | |
| 3218 | rootPartCFrame = previousRootPartCFrame + offset | |
| 3219 | --rootPart.CFrame = rootPartCFrame | |
| 3220 | end | |
| 3221 | end | |
| 3222 | local walkingVelocity = walkDirection * walkSpeed | |
| 3223 | bodyVelocity.velocity = walkingVelocity | |
| 3224 | if not jumpDebounce and math.abs(rootPart.Velocity.Y) <= 0.1 then | |
| 3225 | rootPart.Velocity = Vector3.new(walkingVelocity.X, rootPart.Velocity.Y, walkingVelocity.Z) | |
| 3226 | end | |
| 3227 | previousWalkSpeed = walkSpeed | |
| 3228 | if pose == "Jumping" or jumpDebounce then | |
| 3229 | rightShoulder.MaxVelocity = 0.5 | |
| 3230 | leftShoulder.MaxVelocity = 0.5 | |
| 3231 | rightShoulder.DesiredAngle = 3.14 | |
| 3232 | leftShoulder.DesiredAngle = -3.14 | |
| 3233 | rightHip.DesiredAngle = 0 | |
| 3234 | leftHip.DesiredAngle = 0 | |
| 3235 | elseif pose == "FreeFall" then | |
| 3236 | rightShoulder.MaxVelocity = 0.5 | |
| 3237 | leftShoulder.MaxVelocity = 0.5 | |
| 3238 | rightShoulder.DesiredAngle = 3.14 | |
| 3239 | leftShoulder.DesiredAngle = -3.14 | |
| 3240 | rightHip.DesiredAngle = 0 | |
| 3241 | leftHip.DesiredAngle = 0 | |
| 3242 | elseif pose == "Seated" then | |
| 3243 | rightShoulder.MaxVelocity = 0.15 | |
| 3244 | leftShoulder.MaxVelocity = 0.15 | |
| 3245 | rightShoulder.DesiredAngle = 3.14 / 2 | |
| 3246 | leftShoulder.DesiredAngle = -3.14 / 2 | |
| 3247 | rightHip.DesiredAngle = 3.14 / 2 | |
| 3248 | leftHip.DesiredAngle = -3.14 / 2 | |
| 3249 | else | |
| 3250 | local climbFudge = 0 | |
| 3251 | local amplitude | |
| 3252 | local frequency | |
| 3253 | if pose == "Running" then | |
| 3254 | rightShoulder.MaxVelocity = 0.15 | |
| 3255 | leftShoulder.MaxVelocity = 0.15 | |
| 3256 | amplitude = 1 | |
| 3257 | frequency = 9 | |
| 3258 | elseif (pose == "Climbing") then | |
| 3259 | rightShoulder.MaxVelocity = 0.5 | |
| 3260 | leftShoulder.MaxVelocity = 0.5 | |
| 3261 | amplitude = 1 | |
| 3262 | frequency = 9 | |
| 3263 | climbFudge = 3.14 | |
| 3264 | else | |
| 3265 | amplitude = 0.1 | |
| 3266 | frequency = 1 | |
| 3267 | end | |
| 3268 | local desiredAngle = amplitude * math.sin(totalTime * frequency) | |
| 3269 | rightShoulder.DesiredAngle = desiredAngle + climbFudge | |
| 3270 | leftShoulder.DesiredAngle = desiredAngle - climbFudge | |
| 3271 | rightHip.DesiredAngle = -desiredAngle | |
| 3272 | leftHip.DesiredAngle = -desiredAngle | |
| 3273 | end | |
| 3274 | end | |
| 3275 | previousRootPartCFrame = rootPartCFrame | |
| 3276 | RunService.RenderStepped:wait() | |
| 3277 | end | |
| 3278 | if model.Parent ~= nil then | |
| 3279 | model.Parent = nil | |
| 3280 | end | |
| 3281 | PlayerControl.CreateCharacter() | |
| 3282 | end) | |
| 3283 | humanoid.Health = 100 | |
| 3284 | character = model | |
| 3285 | chatAdornee = head | |
| 3286 | elseif characterMode == "pyramid" then | |
| 3287 | if PlayerControl.characterEnabled then | |
| 3288 | Camera.CameraType = "Fixed" | |
| 3289 | PyramidCharacter.camera_distance = (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude | |
| 3290 | PyramidCharacter.camera_position = Camera.Focus.p | |
| 3291 | PyramidCharacter.Teleport(Camera.Focus.p) | |
| 3292 | PyramidCharacter.visible = true | |
| 3293 | Player.Character = nil | |
| 3294 | else | |
| 3295 | PyramidCharacter.visible = false | |
| 3296 | end | |
| 3297 | end | |
| 3298 | end | |
| 3299 | function PlayerControl.GetCharacter() | |
| 3300 | return character | |
| 3301 | end | |
| 3302 | function PlayerControl.GetHead() | |
| 3303 | local characterMode = PlayerControl.characterMode | |
| 3304 | if characterMode == "normal" then | |
| 3305 | return head | |
| 3306 | elseif characterMode == "pyramid" then | |
| 3307 | return PyramidCharacter.core | |
| 3308 | end | |
| 3309 | end | |
| 3310 | function PlayerControl.GetHumanoid() | |
| 3311 | return humanoid | |
| 3312 | end | |
| 3313 | function PlayerControl.GetRootPart() | |
| 3314 | return rootPart | |
| 3315 | end | |
| 3316 | function PlayerControl.GetTorso() | |
| 3317 | return torso | |
| 3318 | end | |
| 3319 | function PlayerControl.IsEnabled() | |
| 3320 | return PlayerControl.characterEnabled | |
| 3321 | end | |
| 3322 | function PlayerControl.IsFeatherfallEnabled() | |
| 3323 | return PlayerControl.featherfallEnabled | |
| 3324 | end | |
| 3325 | function PlayerControl.IsPushable() | |
| 3326 | return PlayerControl.pushable | |
| 3327 | end | |
| 3328 | function PlayerControl.IsRolling() | |
| 3329 | return PlayerControl.rolling | |
| 3330 | end | |
| 3331 | function PlayerControl.ResetCharacter() | |
| 3332 | if character and character.Parent then | |
| 3333 | character.Parent = nil | |
| 3334 | end | |
| 3335 | PyramidCharacter.visible = false | |
| 3336 | end | |
| 3337 | function PlayerControl.SetEnabled(state, no_animation) | |
| 3338 | state = not not state | |
| 3339 | if state ~= PlayerControl.characterEnabled then | |
| 3340 | PlayerControl.characterEnabled = state | |
| 3341 | local characterMode = PlayerControl.characterMode | |
| 3342 | if characterMode == "normal" then | |
| 3343 | local torso = PlayerControl.GetRootPart() | |
| 3344 | local rootPart = PlayerControl.GetRootPart() | |
| 3345 | if rootPart then | |
| 3346 | if PlayerControl.characterEnabled then | |
| 3347 | local torso_cframe = Camera.Focus:toWorldSpace(PlayerControl.hide_torso_object_cframe) | |
| 3348 | PlayerControl.torso_cframe = torso_cframe | |
| 3349 | torso.CFrame = torso_cframe | |
| 3350 | rootPart.CFrame = torso_cframe | |
| 3351 | else | |
| 3352 | PlayerControl.hide_torso_object_cframe = Camera.Focus:toObjectSpace(rootPart.CFrame) | |
| 3353 | end | |
| 3354 | else | |
| 3355 | PlayerControl.torso_cframe = Camera.Focus | |
| 3356 | end | |
| 3357 | if PlayerControl.characterEnabled then | |
| 3358 | PlayerControl.CreateCharacter() | |
| 3359 | RunService.Stepped:wait() | |
| 3360 | coroutine.yield() | |
| 3361 | if not no_animation then | |
| 3362 | GraphicalEffects.CrystalRing({base_part = PlayerControl.GetTorso(), crystal_color = BrickColor.new("Institutional white"), float_duration = 2})
| |
| 3363 | end | |
| 3364 | else | |
| 3365 | Player.Character = nil | |
| 3366 | Camera.CameraType = "Fixed" | |
| 3367 | if not no_animation then | |
| 3368 | GraphicalEffects.CrystalRing({position = PlayerControl.GetTorso().Position, crystal_color = BrickColor.new("Institutional white"), float_duration = 2})
| |
| 3369 | end | |
| 3370 | end | |
| 3371 | else | |
| 3372 | if state then | |
| 3373 | PlayerControl.CreateCharacter() | |
| 3374 | RunService.Stepped:wait() | |
| 3375 | coroutine.yield() | |
| 3376 | if not no_animation then | |
| 3377 | GraphicalEffects.CrystalRing({base_part = PyramidCharacter.core, crystal_color = BrickColor.new("Institutional white"), float_duration = 2})
| |
| 3378 | end | |
| 3379 | else | |
| 3380 | PyramidCharacter.visible = false | |
| 3381 | if not no_animation then | |
| 3382 | GraphicalEffects.CrystalRing({position = PyramidCharacter.core.Position, crystal_color = BrickColor.new("Institutional white"), float_duration = 2})
| |
| 3383 | end | |
| 3384 | end | |
| 3385 | end | |
| 3386 | end | |
| 3387 | end | |
| 3388 | function PlayerControl.SetFeatherfallEnabled(state) | |
| 3389 | state = not not state | |
| 3390 | if state ~= PlayerControl.featherfallEnabled then | |
| 3391 | PlayerControl.featherfallEnabled = state | |
| 3392 | if state then | |
| 3393 | Logger.print("Info", "Featherfall enabled in PlayerControl")
| |
| 3394 | else | |
| 3395 | Logger.print("Info", "Featherfall disabled in PlayerControl")
| |
| 3396 | end | |
| 3397 | end | |
| 3398 | end | |
| 3399 | function PlayerControl.SetPushable(state) | |
| 3400 | state = not not state | |
| 3401 | if state ~= PlayerControl.pushable then | |
| 3402 | PlayerControl.pushable = state | |
| 3403 | if state then | |
| 3404 | Logger.print("Info", "Pushing enabled in PlayerControl")
| |
| 3405 | else | |
| 3406 | Logger.print("Info", "Pushing disabled in PlayerControl")
| |
| 3407 | end | |
| 3408 | end | |
| 3409 | end | |
| 3410 | function PlayerControl.SetRolling(state) | |
| 3411 | state = not not state | |
| 3412 | if state ~= PlayerControl.rolling then | |
| 3413 | PlayerControl.rolling = state | |
| 3414 | if state then | |
| 3415 | Logger.print("Info", "Rolling fly mode enabled in PlayerControl")
| |
| 3416 | else | |
| 3417 | Logger.print("Info", "Rolling fly mode disabled in PlayerControl")
| |
| 3418 | end | |
| 3419 | end | |
| 3420 | end | |
| 3421 | function PlayerControl.StartFlying() | |
| 3422 | PlayerControl.fly_speed = PlayerControl.fly_basespeed | |
| 3423 | if torso then | |
| 3424 | flyingMomentum = torso.Velocity + torso.CFrame.lookVector * 3 + Vector3.new(0, 10, 0) | |
| 3425 | else | |
| 3426 | flyingMomentum = Vector3.new() | |
| 3427 | end | |
| 3428 | flyingTilt = 0 | |
| 3429 | flying = true | |
| 3430 | end | |
| 3431 | function PlayerControl.StopFlying() | |
| 3432 | if bodyGyro.cframe then | |
| 3433 | local lookVector = bodyGyro.cframe.lookVector | |
| 3434 | if lookVector.X ~= 0 or lookVector.Z ~= 0 then | |
| 3435 | bodyGyro.cframe = CFrame.new(Vector3.new(), Vector3.new(lookVector.X, 0, lookVector.Z)) | |
| 3436 | end | |
| 3437 | end | |
| 3438 | flying = false | |
| 3439 | end | |
| 3440 | local previousTime = 0 | |
| 3441 | ||
| 3442 | ControllerCommands = {};
| |
| 3443 | ||
| 3444 | ControllerCommands = {};
| |
| 3445 | ||
| 3446 | ControllerCommands.BALEFIRE_SPEED = 40 | |
| 3447 | function ControllerCommands.BalefireAtMouse() | |
| 3448 | local head = chatAdornee | |
| 3449 | if head then | |
| 3450 | local target = Mouse.Hit.p | |
| 3451 | local origin = head.Position | |
| 3452 | local direction = (target - origin).unit | |
| 3453 | local explosionCount = 0 | |
| 3454 | local animation_frame = 0 | |
| 3455 | local magic_circle_position = origin + direction * 4 | |
| 3456 | local magic_circle_cframe = CFrame.new(magic_circle_position, magic_circle_position + direction) | |
| 3457 | local magic_circle_part = Instance.new("Part")
| |
| 3458 | local magic_circle_mesh = Instance.new("BlockMesh", magic_circle_part)
| |
| 3459 | local magic_circle_light = Instance.new("PointLight", magic_circle_part)
| |
| 3460 | local magic_circle_decal_back = Instance.new("Decal", magic_circle_part)
| |
| 3461 | local magic_circle_decal_front = Instance.new("Decal", magic_circle_part)
| |
| 3462 | magic_circle_part.Anchored = true | |
| 3463 | magic_circle_part.Archivable = false | |
| 3464 | magic_circle_part.BottomSurface = "Smooth" | |
| 3465 | magic_circle_part.CanCollide = false | |
| 3466 | magic_circle_part.CFrame = magic_circle_cframe | |
| 3467 | magic_circle_part.FormFactor = "Custom" | |
| 3468 | magic_circle_part.Locked = true | |
| 3469 | magic_circle_part.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 3470 | magic_circle_part.TopSurface = "Smooth" | |
| 3471 | magic_circle_part.Transparency = 1 | |
| 3472 | magic_circle_mesh.Scale = Vector3.new(60, 60, 0) | |
| 3473 | magic_circle_light.Color = Color3.new(1, 0.5, 1) | |
| 3474 | magic_circle_light.Range = 16 | |
| 3475 | magic_circle_light.Shadows = true | |
| 3476 | magic_circle_decal_back.Face = "Back" | |
| 3477 | magic_circle_decal_back.Texture = "rbxassetid://122610943" | |
| 3478 | magic_circle_decal_front.Face = "Front" | |
| 3479 | magic_circle_decal_front.Texture = "rbxassetid://122610943" | |
| 3480 | local function NextExplosion() | |
| 3481 | explosionCount = explosionCount + 1 | |
| 3482 | Instance.new("Explosion", Workspace).Position = origin + direction * (explosionCount * 8 + 4)
| |
| 3483 | end | |
| 3484 | local function AnimateMagicCircle() | |
| 3485 | animation_frame = animation_frame + 1 | |
| 3486 | local transparency = (animation_frame / 40) ^ 3 | |
| 3487 | if animation_frame == 40 then | |
| 3488 | pcall(Game.Destroy, magic_circle_part) | |
| 3489 | else | |
| 3490 | if magic_circle_part.Parent ~= Workspace then | |
| 3491 | pcall(Utility.SetProperty, magic_circle_part, "Parent", Workspace) | |
| 3492 | end | |
| 3493 | head = PlayerControl.GetHead() | |
| 3494 | if head then | |
| 3495 | magic_circle_position = head.Position + direction * 4 | |
| 3496 | end | |
| 3497 | magic_circle_part.CFrame = CFrame.new(magic_circle_position, magic_circle_position + direction) * CFrame.Angles(0, 0, | |
| 3498 | ||
| 3499 | math.tau * animation_frame / 40 * 1.5) | |
| 3500 | magic_circle_light.Brightness = 1 - transparency | |
| 3501 | magic_circle_decal_back.Transparency = transparency | |
| 3502 | magic_circle_decal_front.Transparency = transparency | |
| 3503 | end | |
| 3504 | end | |
| 3505 | magic_circle_part.Parent = Workspace | |
| 3506 | for i = 1, 40 do | |
| 3507 | Delay((i - 1) / ControllerCommands.BALEFIRE_SPEED, NextExplosion) | |
| 3508 | Delay((i - 1) / 30, AnimateMagicCircle) | |
| 3509 | end | |
| 3510 | for i = 1, 20 do | |
| 3511 | Delay((i - 1) / ControllerCommands.BALEFIRE_SPEED, NextExplosion) | |
| 3512 | end | |
| 3513 | end | |
| 3514 | end | |
| 3515 | function ControllerCommands.ControlRandomDummy() | |
| 3516 | local dummies = {}
| |
| 3517 | local numDummies = 0 | |
| 3518 | for _, character in ipairs(Workspace:GetChildren()) do | |
| 3519 | local name = tostring(character) | |
| 3520 | if name == "???" or name == "Dummy" then | |
| 3521 | local head, humanoid | |
| 3522 | for _, child in ipairs(character:GetChildren()) do | |
| 3523 | local className = child.ClassName | |
| 3524 | if className == "Part" and tostring(child) == "Head" then | |
| 3525 | head = child | |
| 3526 | if humanoid then | |
| 3527 | break | |
| 3528 | end | |
| 3529 | elseif className == "Humanoid" then | |
| 3530 | if child.Health > 0 then | |
| 3531 | humanoid = child | |
| 3532 | if head then | |
| 3533 | break | |
| 3534 | end | |
| 3535 | else | |
| 3536 | break | |
| 3537 | end | |
| 3538 | end | |
| 3539 | end | |
| 3540 | if head and humanoid then | |
| 3541 | numDummies = numDummies + 1 | |
| 3542 | dummies[numDummies] = {character, head, humanoid}
| |
| 3543 | end | |
| 3544 | end | |
| 3545 | end | |
| 3546 | if numDummies > 0 then | |
| 3547 | local dummy = dummies[math.random(numDummies)] | |
| 3548 | Player.Character = dummy[1] | |
| 3549 | chatAdornee = dummy[2] | |
| 3550 | Camera.CameraSubject = dummy[3] | |
| 3551 | Camera.CameraType = "Track" | |
| 3552 | end | |
| 3553 | end | |
| 3554 | function ControllerCommands.Decalify(textures, exclusion) | |
| 3555 | local objects = Workspace:GetChildren() | |
| 3556 | for _, object in ipairs(objects) do | |
| 3557 | if not exclusion[object] then | |
| 3558 | for _, child in ipairs(object:GetChildren()) do | |
| 3559 | objects[#objects + 1] = child | |
| 3560 | end | |
| 3561 | if object:IsA("BasePart") then
| |
| 3562 | local texture = textures[math.random(#textures)] | |
| 3563 | local face_left = Instance.new("Decal", object)
| |
| 3564 | face_left.Face = Enum.NormalId.Left | |
| 3565 | face_left.Texture = texture | |
| 3566 | local face_right = Instance.new("Decal", object)
| |
| 3567 | face_right.Face = Enum.NormalId.Right | |
| 3568 | face_right.Texture = texture | |
| 3569 | local face_bottom = Instance.new("Decal", object)
| |
| 3570 | face_bottom.Face = Enum.NormalId.Bottom | |
| 3571 | face_bottom.Texture = texture | |
| 3572 | local face_top = Instance.new("Decal", object)
| |
| 3573 | face_top.Face = Enum.NormalId.Top | |
| 3574 | face_top.Texture = texture | |
| 3575 | local face_front = Instance.new("Decal", object)
| |
| 3576 | face_front.Face = Enum.NormalId.Front | |
| 3577 | face_front.Texture = texture | |
| 3578 | local face_back = Instance.new("Decal", object)
| |
| 3579 | face_back.Face = Enum.NormalId.Back | |
| 3580 | face_back.Texture = texture | |
| 3581 | end | |
| 3582 | end | |
| 3583 | end | |
| 3584 | end | |
| 3585 | ||
| 3586 | function ControllerCommands.ExplodeAtMouse() | |
| 3587 | local explosion = Instance.new("Explosion")
| |
| 3588 | explosion.Position = Mouse.Hit.p | |
| 3589 | explosion.Parent = Workspace | |
| 3590 | end | |
| 3591 | function ControllerCommands.LaserAtMouse() | |
| 3592 | GraphicalEffects.ShootLaserOfDeath(Mouse.Hit.p) | |
| 3593 | end | |
| 3594 | function ControllerCommands.BigLaser(target) | |
| 3595 | GraphicalEffects.ShootLaserOfDeath(target, {brickcolor = BrickColor.new("New Yeller"), duration = 80, fragmentation_size = 6,laser_scale = 30, light_color = Color3.new(1, 0.5, 0), magic_circle_image = "rbxassetid://126561317", magic_circle_scale = 1.5, sound_volume = 1,special_effects = BrickColor.new("Deep orange"), stay = 2})
| |
| 3596 | end | |
| 3597 | function ControllerCommands.BigLaserAtMouse() | |
| 3598 | ControllerCommands.BigLaser(Mouse.Hit.p) | |
| 3599 | end | |
| 3600 | function ControllerCommands.ShootMissile(targetPart, pointOnPart, direction) | |
| 3601 | GraphicalEffects.ShootMissile(targetPart, pointOnPart, direction) | |
| 3602 | end | |
| 3603 | function ControllerCommands.ShootMissileAtMouse(amount, spread, delayTime) | |
| 3604 | local exclusionList = {}
| |
| 3605 | local playerHead = PlayerControl.GetHead() | |
| 3606 | local playerTorso = PlayerControl.GetTorso() | |
| 3607 | if playerHead and playerTorso then | |
| 3608 | exclusionList[playerTorso] = true | |
| 3609 | local humanoid, torso = Utility.FindHumanoidClosestToRay(Mouse.UnitRay, exclusionList) | |
| 3610 | local targetPart, pointOnPart | |
| 3611 | if humanoid and torso then | |
| 3612 | targetPart, pointOnPart = torso, Vector3.new() | |
| 3613 | else | |
| 3614 | local target = Mouse.Target | |
| 3615 | if target then | |
| 3616 | targetPart, pointOnPart = target, target.CFrame:pointToObjectSpace(Mouse.Hit.p) | |
| 3617 | else | |
| 3618 | return | |
| 3619 | end | |
| 3620 | end | |
| 3621 | if targetPart then | |
| 3622 | local direction = (Mouse.Hit.p - playerHead.Position).unit | |
| 3623 | delayTime = delayTime or 0 | |
| 3624 | for index = 1, amount do | |
| 3625 | local angles = math.tau * (index - 0.5) * spread / amount * Vector3.new(math.random() - 0.5, math.random() - 0.5,math.random() - 0.5).unit | |
| 3626 | TaskScheduler.Schedule(delayTime * (index - 1), ControllerCommands.ShootMissile, targetPart, pointOnPart, CFrame.Angles(angles.X, angles.Y, angles.Z) * direction) | |
| 3627 | end | |
| 3628 | end | |
| 3629 | end | |
| 3630 | end | |
| 3631 | function ControllerCommands.ShootMissileAroundMouse(amount, offset, delayTime) | |
| 3632 | local exclusionList = {}
| |
| 3633 | local playerHead = PlayerControl.GetHead() | |
| 3634 | local playerTorso = PlayerControl.GetTorso() | |
| 3635 | if playerHead and playerTorso then | |
| 3636 | exclusionList[playerTorso] = true | |
| 3637 | local humanoid, torso = Utility.FindHumanoidClosestToRay(Mouse.UnitRay, exclusionList) | |
| 3638 | local targetPart, pointOnPart | |
| 3639 | if humanoid and torso then | |
| 3640 | targetPart, pointOnPart = torso, Vector3.new() | |
| 3641 | else | |
| 3642 | local target = Mouse.Target | |
| 3643 | if target then | |
| 3644 | targetPart, pointOnPart = target, target.CFrame:pointToObjectSpace(Mouse.Hit.p) | |
| 3645 | else | |
| 3646 | return | |
| 3647 | end | |
| 3648 | end | |
| 3649 | if targetPart then | |
| 3650 | delayTime = delayTime or 0 | |
| 3651 | local index = 1 | |
| 3652 | local targetPoint = targetPart.CFrame * pointOnPart | |
| 3653 | local rotation_offset_angles = math.tau * Vector3.new(math.random() - 0.5, math.random() - 0.5, 0).unit | |
| 3654 | local rotation_offset = CFrame.Angles(rotation_offset_angles.x, rotation_offset_angles.y, 0) | |
| 3655 | local angle_x = 0 | |
| 3656 | local angle_x_step = math.tau / math.phi | |
| 3657 | for i = 1, 8 * amount do | |
| 3658 | angle_x = angle_x + angle_x_step | |
| 3659 | local direction = rotation_offset * (CFrame.Angles(0, math.tau * index / amount, 0) * CFrame.Angles(angle_x, 0,0).lookVector) | |
| 3660 | local blocked = Workspace:FindPartOnRay(Ray.new(targetPoint, direction * offset), targetPart.Parent) | |
| 3661 | if not blocked then | |
| 3662 | local p0, p1, p2, p3 = targetPart, pointOnPart, direction, offset; GraphicalEffects.ShootMissile(p0, p1, p2, function() return p0 end, p3, true) | |
| 3663 | index = index + 1 | |
| 3664 | if index > amount then | |
| 3665 | break | |
| 3666 | end | |
| 3667 | end | |
| 3668 | end | |
| 3669 | end | |
| 3670 | end | |
| 3671 | end | |
| 3672 | ||
| 3673 | function ControllerCommands.HugeExplosionOfDoom(position) | |
| 3674 | local connections = {}
| |
| 3675 | local parts = {}
| |
| 3676 | local cframe = CFrame.new(position) | |
| 3677 | local function ExplosionHit(part) | |
| 3678 | if part:GetMass() < 10000 and part.Parent ~= Camera then | |
| 3679 | parts[part] = true | |
| 3680 | part.Anchored = true | |
| 3681 | part:BreakJoints() | |
| 3682 | part.BrickColor = BrickColor.new("Instituational white")
| |
| 3683 | end | |
| 3684 | end | |
| 3685 | for i = 1, 4 do | |
| 3686 | local quantity = 0.5 * i * (1 + i) | |
| 3687 | local fraction = math.tau / quantity | |
| 3688 | for x = 1, quantity do | |
| 3689 | for y = 1, quantity do | |
| 3690 | local explosion = Instance.new("Explosion")
| |
| 3691 | connections[#connections + 1] = explosion.Hit:connect(ExplosionHit) | |
| 3692 | explosion.BlastRadius = 5 | |
| 3693 | explosion.Position = cframe * (CFrame.Angles(fraction * x, fraction * y, 0) * Vector3.new((i - 1) * 6, 0, 0)) | |
| 3694 | explosion.Parent = Workspace | |
| 3695 | end | |
| 3696 | end | |
| 3697 | wait(0.075) | |
| 3698 | end | |
| 3699 | for part in pairs(parts) do | |
| 3700 | for _, child in ipairs(part:GetChildren()) do | |
| 3701 | if child:IsA("BodyMover") then
| |
| 3702 | child:Destroy() | |
| 3703 | end | |
| 3704 | end | |
| 3705 | local mass = part:GetMass() | |
| 3706 | local velocity = CFrame.Angles(math.tau * math.random(), math.tau * math.random(), 0) * Vector3.new(25, 0, 0) | |
| 3707 | local bodythrust = Instance.new("BodyThrust")
| |
| 3708 | bodythrust.force = mass * -velocity | |
| 3709 | bodythrust.Parent = part | |
| 3710 | local bodyforce = Instance.new("BodyForce")
| |
| 3711 | bodyforce.force = mass * Vector3.new(0, 196.2, 0) | |
| 3712 | bodyforce.Parent = part | |
| 3713 | part.Anchored = false | |
| 3714 | part.Reflectance = 1 | |
| 3715 | part.RotVelocity = math.tau * Vector3.new(math.random() - 0.5, math.random() - 0.5, math.random() - 0.5) | |
| 3716 | part.Transparency = 0.5 | |
| 3717 | part.Velocity = (part.CFrame - part.Position) * velocity | |
| 3718 | end | |
| 3719 | for _, connection in ipairs(connections) do | |
| 3720 | connection:disconnect() | |
| 3721 | end | |
| 3722 | for i = 0, 99 do | |
| 3723 | Delay(i / 10, function() | |
| 3724 | for part in pairs(parts) do | |
| 3725 | local new_transparency = 0.5 * (1 + i / 50) | |
| 3726 | part.Reflectance = 0.98 * part.Reflectance | |
| 3727 | if new_transparency > part.Transparency then | |
| 3728 | part.Transparency = new_transparency | |
| 3729 | end | |
| 3730 | end | |
| 3731 | end) | |
| 3732 | end | |
| 3733 | Delay(10, function() | |
| 3734 | for part in pairs(parts) do | |
| 3735 | pcall(part.Destroy, part) | |
| 3736 | end | |
| 3737 | end) | |
| 3738 | end | |
| 3739 | function ControllerCommands.HugeExplosionOfDoomAtMouse() | |
| 3740 | ControllerCommands.HugeExplosionOfDoom(Mouse.Hit.p) | |
| 3741 | end | |
| 3742 | ||
| 3743 | function ControllerCommands.SpaceHyperBeam(asd) | |
| 3744 | GraphicalEffects.SpaceHyperBeam(asd) | |
| 3745 | end | |
| 3746 | function ControllerCommands.SpaceHyperBeamAtMouse() | |
| 3747 | ControllerCommands.SpaceHyperBeam(Mouse.Hit.p) | |
| 3748 | end | |
| 3749 | function ControllerCommands.ConcentratedSpaceHyperBeamAtMouse() | |
| 3750 | local p = Mouse.Hit.p; for i = 1, 50 do GraphicalEffects.SpaceHyperBeam(p) end | |
| 3751 | end | |
| 3752 | ||
| 3753 | function ControllerCommands.TeleportCharacterToMouse() | |
| 3754 | if PlayerControl.IsEnabled() then | |
| 3755 | local torso = PlayerControl.GetTorso() | |
| 3756 | if torso then | |
| 3757 | local pos = Mouse.Hit.p + Vector3.new(0, 5, 0) | |
| 3758 | torso.CFrame = CFrame.new(pos, pos + torso.CFrame.lookVector) | |
| 3759 | end | |
| 3760 | else | |
| 3761 | local new_focus_position = Mouse.Hit.p | |
| 3762 | local direction_vector = Camera.CoordinateFrame.lookVector | |
| 3763 | local new_focus = CFrame.new(new_focus_position, new_focus_position + direction_vector) | |
| 3764 | Camera.CoordinateFrame = new_focus * CFrame.new(0, 0, 25) | |
| 3765 | Camera.Focus = new_focus | |
| 3766 | end | |
| 3767 | end | |
| 3768 | ||
| 3769 | AdvancedGUI = {};
| |
| 3770 | ||
| 3771 | if not AdvancedGUI.GUI_BASE_COLOR then | |
| 3772 | AdvancedGUI.GUI_BASE_COLOR = Color3.new(0, 0, 0) | |
| 3773 | end | |
| 3774 | function AdvancedGUI.GenerateChatColor(speakerName) | |
| 3775 | local chatColor = ChatColor.Get(speakerName).Color | |
| 3776 | local brightness = chatColor.r + chatColor.g + chatColor.b | |
| 3777 | if brightness < 1.5 then | |
| 3778 | chatColor = Color3.new(math.min(1, 0.4 + chatColor.r), math.min(1, 0.4 + chatColor.g), math.min(1, 0.4 + chatColor.b)) | |
| 3779 | else | |
| 3780 | chatColor = Color3.new(math.min(1, 0.05 + chatColor.r), math.min(1, 0.05 + chatColor.g), math.min(1, 0.05 + chatColor.b)) | |
| 3781 | end | |
| 3782 | return chatColor | |
| 3783 | end | |
| 3784 | GuiBase = {}
| |
| 3785 | GuiBase.__index = GuiBase | |
| 3786 | function GuiBase:new(data) | |
| 3787 | local instance = setmetatable({}, self)
| |
| 3788 | instance:Init(data) | |
| 3789 | return instance | |
| 3790 | end | |
| 3791 | function GuiBase:Destroy() | |
| 3792 | if self.parent then | |
| 3793 | self.parent.children[self] = nil | |
| 3794 | end | |
| 3795 | for child in pairs(self.children) do | |
| 3796 | child:Destroy() | |
| 3797 | end | |
| 3798 | self.m_base_instance:Destroy() | |
| 3799 | end | |
| 3800 | function GuiBase:GetContentInstance(child) | |
| 3801 | return self.m_base_instance | |
| 3802 | end | |
| 3803 | function GuiBase:Init() | |
| 3804 | self.children = {}
| |
| 3805 | end | |
| 3806 | function GuiBase:IsA(className) | |
| 3807 | return className == "GuiBase" | |
| 3808 | end | |
| 3809 | function GuiBase:SetParent(parent) | |
| 3810 | if parent ~= self.parent then | |
| 3811 | if self.parent then | |
| 3812 | self.parent.children[self] = nil | |
| 3813 | end | |
| 3814 | self.parent = parent | |
| 3815 | if parent then | |
| 3816 | parent.children[self] = true | |
| 3817 | self.m_base_instance.Parent = parent:GetContentInstance() | |
| 3818 | else | |
| 3819 | self.m_base_instance.Parent = nil | |
| 3820 | end | |
| 3821 | end | |
| 3822 | end | |
| 3823 | GuiObject = setmetatable({}, GuiBase)
| |
| 3824 | GuiObject.__index = GuiObject | |
| 3825 | function GuiObject:Destroy() | |
| 3826 | self.DragBegin:disconnect() | |
| 3827 | self.DragMove:disconnect() | |
| 3828 | self.DragStopped:disconnect() | |
| 3829 | self.MouseButton1Click:disconnect() | |
| 3830 | self.MouseButton1Down:disconnect() | |
| 3831 | self.MouseButton1Up:disconnect() | |
| 3832 | self.MouseButton2Down:disconnect() | |
| 3833 | self.MouseButton2Up:disconnect() | |
| 3834 | self.MouseEnter:disconnect() | |
| 3835 | self.MouseLeave:disconnect() | |
| 3836 | GuiBase.Destroy(self) | |
| 3837 | end | |
| 3838 | function GuiObject:GetAbsolutePosition() | |
| 3839 | return self.m_base_instance.AbsolutePosition | |
| 3840 | end | |
| 3841 | function GuiObject:GetAbsoluteSize() | |
| 3842 | return self.m_base_instance.AbsoluteSize | |
| 3843 | end | |
| 3844 | function GuiObject:GetPosition() | |
| 3845 | return self.position | |
| 3846 | end | |
| 3847 | function GuiObject:GetSize() | |
| 3848 | return self.size | |
| 3849 | end | |
| 3850 | function GuiObject:Init() | |
| 3851 | GuiBase.Init(self) | |
| 3852 | self.mouseDown = false | |
| 3853 | self.mouseOver = false | |
| 3854 | self.DragBegin = RbxUtility.CreateSignal() | |
| 3855 | self.DragMove = RbxUtility.CreateSignal() | |
| 3856 | self.DragStopped = RbxUtility.CreateSignal() | |
| 3857 | self.MouseButton1Click = RbxUtility.CreateSignal() | |
| 3858 | self.MouseButton1Down = RbxUtility.CreateSignal() | |
| 3859 | self.MouseButton1Up = RbxUtility.CreateSignal() | |
| 3860 | self.MouseButton2Down = RbxUtility.CreateSignal() | |
| 3861 | self.MouseButton2Up = RbxUtility.CreateSignal() | |
| 3862 | self.MouseEnter = RbxUtility.CreateSignal() | |
| 3863 | self.MouseLeave = RbxUtility.CreateSignal() | |
| 3864 | end | |
| 3865 | function GuiObject:IsA(className) | |
| 3866 | return className == "GuiObject" or GuiBase.IsA(self, className) | |
| 3867 | end | |
| 3868 | function GuiObject:SetActive(active) | |
| 3869 | if active ~= self.active then | |
| 3870 | self.active = active | |
| 3871 | end | |
| 3872 | end | |
| 3873 | function GuiObject:SetBackgroundTransparency(backgroundTransparency) | |
| 3874 | if backgroundTransparency ~= self.backgroundTransparency then | |
| 3875 | self.backgroundTransparency = backgroundTransparency | |
| 3876 | self.m_base_instance.BackgroundTransparency = backgroundTransparency | |
| 3877 | end | |
| 3878 | end | |
| 3879 | function GuiObject:SetColor(color) | |
| 3880 | if color ~= self.color then | |
| 3881 | self.color = color | |
| 3882 | self.m_base_instance.BackgroundColor3 = color | |
| 3883 | end | |
| 3884 | end | |
| 3885 | function GuiObject:SetPosition(position) | |
| 3886 | if position ~= self.position then | |
| 3887 | self.position = position | |
| 3888 | self.m_base_instance.Position = position | |
| 3889 | end | |
| 3890 | end | |
| 3891 | function GuiObject:SetSize(size) | |
| 3892 | if size ~= self.size then | |
| 3893 | self.size = size | |
| 3894 | self.m_base_instance.Size = size | |
| 3895 | end | |
| 3896 | end | |
| 3897 | function GuiObject:SetVisible(visible) | |
| 3898 | if visible ~= self.visible then | |
| 3899 | self.visible = visible | |
| 3900 | self.m_base_instance.Visible = visible | |
| 3901 | end | |
| 3902 | end | |
| 3903 | function GuiObject:SetZIndex(zIndex) | |
| 3904 | local stack = {self.m_base_instance}
| |
| 3905 | repeat | |
| 3906 | local object = stack[#stack] | |
| 3907 | stack[#stack] = nil | |
| 3908 | for _, child in ipairs(object:GetChildren()) do | |
| 3909 | stack[#stack + 1] = child | |
| 3910 | end | |
| 3911 | object.ZIndex = zIndex | |
| 3912 | until #stack == 0 | |
| 3913 | end | |
| 3914 | GuiServiceClass = setmetatable({}, GuiBase)
| |
| 3915 | GuiServiceClass.__index = GuiServiceClass | |
| 3916 | function GuiServiceClass:CreateTextArea(text, font, fontSize, textColor3, textXAlignment, textYAlignment, maxWidth, minWidth) | |
| 3917 | local totalHeight = 0 | |
| 3918 | local frame = Instance.new("Frame")
| |
| 3919 | frame.BackgroundTransparency = 1 | |
| 3920 | local label = Instance.new("TextLabel")
| |
| 3921 | label.BackgroundTransparency = 1 | |
| 3922 | label.Font = font | |
| 3923 | label.FontSize = fontSize | |
| 3924 | label.TextColor3 = textColor3 | |
| 3925 | label.TextTransparency = 1 | |
| 3926 | label.TextWrapped = true | |
| 3927 | label.TextXAlignment = textXAlignment | |
| 3928 | label.TextYAlignment = textYAlignment | |
| 3929 | label.Parent = self.guiFrame | |
| 3930 | local index = 1 | |
| 3931 | while true do | |
| 3932 | local length = #text - index + 1 | |
| 3933 | if length > 1024 then | |
| 3934 | length = 1024 | |
| 3935 | local textBlock = string.sub(text, index, index + length - 1) | |
| 3936 | label.Text = textBlock | |
| 3937 | local height = 0 | |
| 3938 | local width = maxWidth | |
| 3939 | repeat | |
| 3940 | height = height + 20 | |
| 3941 | label.Size = UDim2.new(0, width, 0, height) | |
| 3942 | until label.TextFits | |
| 3943 | repeat | |
| 3944 | height = height - 1 | |
| 3945 | label.Size = UDim2.new(0, width, 0, height) | |
| 3946 | until not label.TextFits | |
| 3947 | repeat | |
| 3948 | length = length - 10 | |
| 3949 | label.Text = string.sub(text, index, index + length - 1) | |
| 3950 | until label.TextFits | |
| 3951 | repeat | |
| 3952 | length = length + 1 | |
| 3953 | label.Text = string.sub(text, index, index + length - 1) | |
| 3954 | until not label.TextFits | |
| 3955 | local overflowCharacter = string.sub(text, index + length - 1, index + length - 1) | |
| 3956 | length = length - 1 | |
| 3957 | label.Text = string.sub(text, index, index + length - 1) | |
| 3958 | if overflowCharacter == "\n" then | |
| 3959 | index = index + 1 | |
| 3960 | end | |
| 3961 | repeat | |
| 3962 | height = height - 1 | |
| 3963 | label.Size = UDim2.new(0, width, 0, height) | |
| 3964 | until not label.TextFits | |
| 3965 | height = height + 1 | |
| 3966 | local blockLabel = label:Clone() | |
| 3967 | blockLabel.Position = UDim2.new(0, 0, 0, totalHeight) | |
| 3968 | blockLabel.Size = UDim2.new(1, 0, 0, height) | |
| 3969 | blockLabel.Parent = frame | |
| 3970 | totalHeight = totalHeight + height | |
| 3971 | index = index + length | |
| 3972 | else | |
| 3973 | local textBlock = string.sub(text, index) | |
| 3974 | label.Text = textBlock | |
| 3975 | local height = 0 | |
| 3976 | local width = maxWidth | |
| 3977 | repeat | |
| 3978 | height = height + 20 | |
| 3979 | label.Size = UDim2.new(0, width, 0, height) | |
| 3980 | until label.TextFits | |
| 3981 | repeat | |
| 3982 | height = height - 1 | |
| 3983 | label.Size = UDim2.new(0, width, 0, height) | |
| 3984 | until not label.TextFits | |
| 3985 | height = height + 1 | |
| 3986 | if index == 1 then | |
| 3987 | repeat | |
| 3988 | width = width - 10 | |
| 3989 | label.Size = UDim2.new(0, width, 0, height) | |
| 3990 | until width < minWidth or not label.TextFits | |
| 3991 | width = math.max(width, minWidth - 1) | |
| 3992 | repeat | |
| 3993 | width = width + 1 | |
| 3994 | label.Size = UDim2.new(0, width, 0, height) | |
| 3995 | until label.TextFits | |
| 3996 | end | |
| 3997 | local blockLabel = label:Clone() | |
| 3998 | blockLabel.Position = UDim2.new(0, 0, 0, totalHeight) | |
| 3999 | blockLabel.Size = UDim2.new(1, 0, 0, height) | |
| 4000 | blockLabel.Parent = frame | |
| 4001 | label:Destroy() | |
| 4002 | frame.Size = UDim2.new(0, width, 0, totalHeight + height) | |
| 4003 | return frame | |
| 4004 | end | |
| 4005 | end | |
| 4006 | end | |
| 4007 | function GuiServiceClass:Destroy() | |
| 4008 | self.running = false | |
| 4009 | self.cameraPart:Destroy() | |
| 4010 | self.cameraConnection:disconnect() | |
| 4011 | self.keyDownConnection:disconnect() | |
| 4012 | self.mouseButton1DownConnection:disconnect() | |
| 4013 | self.mouseButton1UpConnection:disconnect() | |
| 4014 | self.mouseButton2DownConnection:disconnect() | |
| 4015 | self.mouseButton2UpConnection:disconnect() | |
| 4016 | self.mouseMoveConnection:disconnect() | |
| 4017 | self.steppedConnection:disconnect() | |
| 4018 | end | |
| 4019 | function GuiServiceClass:GetMousePosition() | |
| 4020 | local mouse = self.mouse | |
| 4021 | return mouse.X, mouse.Y -- mouse.X, mouse.Y + 2 -- return mouse.X - 2, mouse.Y - 3 | |
| 4022 | end | |
| 4023 | function GuiServiceClass:GetTextBounds(text, font, fontSize, alignX, alignY, width) | |
| 4024 | local tempLabel = self.tempLabel | |
| 4025 | tempLabel.Font = font | |
| 4026 | tempLabel.FontSize = fontSize | |
| 4027 | tempLabel.Size = UDim2.new(0, width, 0, 4096) | |
| 4028 | tempLabel.Text = text | |
| 4029 | tempLabel.TextXAlignment = alignX | |
| 4030 | tempLabel.TextYAlignment = alignY | |
| 4031 | local textBounds = tempLabel.TextBounds | |
| 4032 | tempLabel.Text = "" | |
| 4033 | return textBounds | |
| 4034 | end | |
| 4035 | function GuiServiceClass:Init(data) | |
| 4036 | GuiBase.Init(self) | |
| 4037 | local _ = string.char | |
| 4038 | local camera = data.Camera | |
| 4039 | local mouse = data.Mouse | |
| 4040 | local cameraPart = Instance.new("Part")
| |
| 4041 | local billboardGui = Instance.new("BillboardGui", cameraPart)
| |
| 4042 | guiFrame = Instance.new("Frame", billboardGui)
| |
| 4043 | cameraPart.Anchored = true | |
| 4044 | cameraPart.BottomSurface = "Smooth" | |
| 4045 | cameraPart.CanCollide = false | |
| 4046 | -- cameraPart.CFrame = CFrame.new(16384, 16384, 16384) | |
| 4047 | cameraPart.FormFactor = "Custom" | |
| 4048 | cameraPart.Locked = true | |
| 4049 | cameraPart.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 4050 | cameraPart.TopSurface = "Smooth" | |
| 4051 | cameraPart.Transparency = 1 | |
| 4052 | billboardGui.Adornee = cameraPart | |
| 4053 | billboardGui.AlwaysOnTop = true | |
| 4054 | -- billboardGui.ExtentsOffset = Vector3.new(-16384, -16384, -16384) | |
| 4055 | guiFrame.BackgroundTransparency = 1 | |
| 4056 | cameraPart.Parent = camera | |
| 4057 | self.running = true | |
| 4058 | self.m_base_instance = guiFrame | |
| 4059 | self.billboardGui = billboardGui | |
| 4060 | self.cameraPart = cameraPart | |
| 4061 | self.tempLabel = RBXInstance.new "TextLabel" {
| |
| 4062 | BackgroundTransparency = 1, | |
| 4063 | TextTransparency = 1, | |
| 4064 | TextWrapped = true, | |
| 4065 | Parent = guiFrame | |
| 4066 | } | |
| 4067 | self.mnemonics = {}
| |
| 4068 | self.visible = true | |
| 4069 | self.camera = camera | |
| 4070 | self.mouse = mouse | |
| 4071 | self.cameraConnection = camera.Changed:connect(function(property) | |
| 4072 | self:UpdateView() | |
| 4073 | if property == "CameraType" then | |
| 4074 | if camera.CameraType ~= Enum.CameraType.Track and camera.CameraType ~= Enum.CameraType.Fixed then | |
| 4075 | camera.CameraType = Enum.CameraType.Track | |
| 4076 | end | |
| 4077 | elseif property == "CoordinateFrame" and camera.CameraType ~= Enum.CameraType.Fixed then | |
| 4078 | local cframe, focus = camera.CoordinateFrame, camera.Focus | |
| 4079 | local watchOffset = focus.p - cframe.p | |
| 4080 | local error = watchOffset.unit - cframe.lookVector | |
| 4081 | if error.magnitude >= 1e-3 then | |
| 4082 | local head = PlayerControl.GetHead() | |
| 4083 | local time1, velocity1 | |
| 4084 | if head then | |
| 4085 | time1 = time() | |
| 4086 | velocity1 = head.Velocity | |
| 4087 | end | |
| 4088 | if camera.Changed:wait() == "CoordinateFrame" then | |
| 4089 | local position = cframe.p | |
| 4090 | if head then | |
| 4091 | local time2 = time() | |
| 4092 | local velocity2 = head.Velocity | |
| 4093 | position = position + 0.5 * (velocity1 + velocity2) * (time2 - time1) | |
| 4094 | end | |
| 4095 | camera.CoordinateFrame = CFrame.new(position, camera.Focus.p) | |
| 4096 | end | |
| 4097 | end | |
| 4098 | end | |
| 4099 | end) | |
| 4100 | self.keyDownConnection = mouse.KeyDown:connect(function(key) self:KeyDown(key) end) | |
| 4101 | self.mouseButton1DownConnection = mouse.Button1Down:connect(function() self:MouseButton1Down() end) | |
| 4102 | self.mouseButton1UpConnection = mouse.Button1Up:connect(function() self:MouseButton1Up() end) | |
| 4103 | self.mouseButton2DownConnection = mouse.Button2Down:connect(function() self:MouseButton2Down() end) | |
| 4104 | self.mouseButton2UpConnection = mouse.Button2Up:connect(function() self:MouseButton2Up() end) | |
| 4105 | self.mouseMoveConnection = mouse.Move:connect(function() self:MouseMove() end) | |
| 4106 | self.steppedConnection = RunService.RenderStepped:connect(function() self:UpdateObjects() self:UpdateView() end) | |
| 4107 | self.mousePreviousPosition = Vector2.new(self:GetMousePosition()) | |
| 4108 | end | |
| 4109 | function GuiServiceClass:IsA(className) | |
| 4110 | return className == "GuiService" or GuiBase.IsA(self, className) | |
| 4111 | end | |
| 4112 | function GuiServiceClass:KeyDown(key) | |
| 4113 | local mnemonicButton = self.mnemonics[string.upper(key)] | |
| 4114 | if mnemonicButton then | |
| 4115 | mnemonicButton.Activated:fire() | |
| 4116 | end | |
| 4117 | end | |
| 4118 | function GuiServiceClass:MouseButton1Down() | |
| 4119 | local mouse = self.mouse | |
| 4120 | local mouseX, mouseY = self:GetMousePosition() | |
| 4121 | local stack = {self}
| |
| 4122 | local dragObjects = {}
| |
| 4123 | self.dragObjects = dragObjects | |
| 4124 | while #stack > 0 do | |
| 4125 | local object = stack[#stack] | |
| 4126 | stack[#stack] = nil | |
| 4127 | if object.visible then | |
| 4128 | for child in pairs(object.children) do | |
| 4129 | stack[#stack + 1] = child | |
| 4130 | end | |
| 4131 | if object.active then | |
| 4132 | local position = object:GetAbsolutePosition() | |
| 4133 | local size = object:GetAbsoluteSize() | |
| 4134 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
| 4135 | object.mouseDown = true | |
| 4136 | dragObjects[object] = true | |
| 4137 | local mouseButton1Down = object.MouseButton1Down | |
| 4138 | if mouseButton1Down then | |
| 4139 | mouseButton1Down:fire() | |
| 4140 | if object.autoButtonColor then | |
| 4141 | local color = object.color | |
| 4142 | local transparency = object.backgroundTransparency | |
| 4143 | object.m_base_instance.BackgroundColor3 = Color3.new(math.min(color.r + 0.3, 1), math.min(color.g + | |
| 4144 | ||
| 4145 | 0.3, 1), math.min(color.b + 0.3, 1)) | |
| 4146 | object.m_base_instance.BackgroundTransparency = transparency | |
| 4147 | end | |
| 4148 | end | |
| 4149 | object.DragBegin:fire() | |
| 4150 | end | |
| 4151 | end | |
| 4152 | end | |
| 4153 | end | |
| 4154 | self.mousePreviousPosition = Vector2.new(mouseX, mouseY) | |
| 4155 | end | |
| 4156 | function GuiServiceClass:MouseButton1Up() | |
| 4157 | local mouse = self.mouse | |
| 4158 | local mouseX, mouseY = self:GetMousePosition() | |
| 4159 | local stack = {self}
| |
| 4160 | while #stack > 0 do | |
| 4161 | local object = stack[#stack] | |
| 4162 | stack[#stack] = nil | |
| 4163 | if object.visible then | |
| 4164 | for child in pairs(object.children) do | |
| 4165 | stack[#stack + 1] = child | |
| 4166 | end | |
| 4167 | if object.active then | |
| 4168 | local position = object:GetAbsolutePosition() | |
| 4169 | local size = object:GetAbsoluteSize() | |
| 4170 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
| 4171 | object.MouseButton1Up:fire() | |
| 4172 | end | |
| 4173 | end | |
| 4174 | end | |
| 4175 | end | |
| 4176 | local dragObjects = self.dragObjects | |
| 4177 | self.dragObjects = nil | |
| 4178 | if dragObjects then | |
| 4179 | for dragObject in pairs(dragObjects) do | |
| 4180 | dragObject.mouseDown = false | |
| 4181 | local position = dragObject:GetAbsolutePosition() | |
| 4182 | local size = dragObject:GetAbsoluteSize() | |
| 4183 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
| 4184 | dragObject.MouseButton1Click:fire() | |
| 4185 | local activated = dragObject.Activated | |
| 4186 | if activated then | |
| 4187 | activated:fire() | |
| 4188 | end | |
| 4189 | end | |
| 4190 | dragObject.DragStopped:fire() | |
| 4191 | if dragObject.autoButtonColor then | |
| 4192 | if dragObject.mouseOver then | |
| 4193 | local color = dragObject.color | |
| 4194 | local transparency = dragObject.backgroundTransparency | |
| 4195 | dragObject.m_base_instance.BackgroundColor3 = Color3.new(math.max(color.r - 0.3, 0), math.max(color.g - 0.3, 0), | |
| 4196 | ||
| 4197 | math.max(color.b - 0.3, 0)) | |
| 4198 | dragObject.m_base_instance.BackgroundTransparency = math.max(0, transparency - 0.2) | |
| 4199 | else | |
| 4200 | dragObject.m_base_instance.BackgroundColor3 = dragObject.color | |
| 4201 | dragObject.m_base_instance.BackgroundTransparency = dragObject.backgroundTransparency | |
| 4202 | end | |
| 4203 | end | |
| 4204 | self.dragObject = nil | |
| 4205 | end | |
| 4206 | end | |
| 4207 | end | |
| 4208 | function GuiServiceClass:MouseButton2Down() | |
| 4209 | local mouse = self.mouse | |
| 4210 | local mouseX, mouseY = self:GetMousePosition() | |
| 4211 | local stack = {self}
| |
| 4212 | while #stack > 0 do | |
| 4213 | local object = stack[#stack] | |
| 4214 | stack[#stack] = nil | |
| 4215 | if object.visible then | |
| 4216 | for child in pairs(object.children) do | |
| 4217 | stack[#stack + 1] = child | |
| 4218 | end | |
| 4219 | if object.active then | |
| 4220 | local position = object:GetAbsolutePosition() | |
| 4221 | local size = object:GetAbsoluteSize() | |
| 4222 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
| 4223 | local mouseButton2Down = object.MouseButton2Down | |
| 4224 | if mouseButton2Down then | |
| 4225 | mouseButton2Down:fire() | |
| 4226 | end | |
| 4227 | end | |
| 4228 | end | |
| 4229 | end | |
| 4230 | end | |
| 4231 | self.mousePreviousPosition = Vector2.new(mouseX, mouseY) | |
| 4232 | end | |
| 4233 | function GuiServiceClass:MouseButton2Up() | |
| 4234 | local mouse = self.mouse | |
| 4235 | local mouseX, mouseY = self:GetMousePosition() | |
| 4236 | local stack = {self}
| |
| 4237 | while #stack > 0 do | |
| 4238 | local object = stack[#stack] | |
| 4239 | stack[#stack] = nil | |
| 4240 | if object.visible then | |
| 4241 | for child in pairs(object.children) do | |
| 4242 | stack[#stack + 1] = child | |
| 4243 | end | |
| 4244 | if object.active then | |
| 4245 | local position = object:GetAbsolutePosition() | |
| 4246 | local size = object:GetAbsoluteSize() | |
| 4247 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
| 4248 | local mouseButton2Up = object.MouseButton2Up | |
| 4249 | if mouseButton2Up then | |
| 4250 | mouseButton2Up:fire() | |
| 4251 | end | |
| 4252 | end | |
| 4253 | end | |
| 4254 | end | |
| 4255 | end | |
| 4256 | end | |
| 4257 | function GuiServiceClass:MouseMove() | |
| 4258 | self:UpdateObjects() | |
| 4259 | local dragObjects = self.dragObjects | |
| 4260 | if dragObjects then | |
| 4261 | for dragObject in pairs(dragObjects) do | |
| 4262 | local mouse = self.mouse | |
| 4263 | local mousePosition = Vector2.new(self:GetMousePosition()) | |
| 4264 | dragObject.DragMove:fire(mousePosition - self.mousePreviousPosition) | |
| 4265 | self.mousePreviousPosition = mousePosition | |
| 4266 | end | |
| 4267 | end | |
| 4268 | end | |
| 4269 | function GuiServiceClass:SetMnemonic(mnemonic, button) | |
| 4270 | self.mnemonics[mnemonic] = button | |
| 4271 | end | |
| 4272 | function GuiServiceClass:UpdateObjects() | |
| 4273 | local mouse = self.mouse | |
| 4274 | local mouseX, mouseY = self:GetMousePosition() | |
| 4275 | local stack = {self}
| |
| 4276 | while #stack > 0 do | |
| 4277 | local object = stack[#stack] | |
| 4278 | stack[#stack] = nil | |
| 4279 | if object.visible then | |
| 4280 | for child in pairs(object.children) do | |
| 4281 | stack[#stack + 1] = child | |
| 4282 | end | |
| 4283 | if object.active then | |
| 4284 | local position = object:GetAbsolutePosition() | |
| 4285 | local size = object:GetAbsoluteSize() | |
| 4286 | if mouseX >= position.X and mouseY >= position.Y and mouseX < position.X + size.X and mouseY < position.Y + size.Y then | |
| 4287 | if not object.mouseOver then | |
| 4288 | object.mouseOver = true | |
| 4289 | object.MouseEnter:fire() | |
| 4290 | if object.autoButtonColor then | |
| 4291 | local color = object.color | |
| 4292 | local transparency = object.backgroundTransparency | |
| 4293 | if object.mouseDown then | |
| 4294 | object.m_base_instance.BackgroundColor3 = Color3.new(math.min(color.r + 0.3, 1), math.min(color.g + 0.3, 1), math.min(color.b + 0.3, 1)) | |
| 4295 | object.m_base_instance.BackgroundTransparency = transparency | |
| 4296 | else | |
| 4297 | object.m_base_instance.BackgroundColor3 = Color3.new(math.max(color.r - 0.3, 0), math.max(color.g - 0.3, 0), math.max(color.b - 0.3, 0)) | |
| 4298 | object.m_base_instance.BackgroundTransparency = math.max(0, transparency - 0.2) | |
| 4299 | end | |
| 4300 | end | |
| 4301 | end | |
| 4302 | else | |
| 4303 | if object.mouseOver then | |
| 4304 | object.mouseOver = false | |
| 4305 | object.MouseLeave:fire() | |
| 4306 | if object.autoButtonColor then | |
| 4307 | object.m_base_instance.BackgroundColor3 = object.color | |
| 4308 | object.m_base_instance.BackgroundTransparency = object.backgroundTransparency | |
| 4309 | end | |
| 4310 | end | |
| 4311 | end | |
| 4312 | end | |
| 4313 | end | |
| 4314 | end | |
| 4315 | end | |
| 4316 | function GuiServiceClass:UpdateView() | |
| 4317 | local billboardGui = self.billboardGui | |
| 4318 | local guiFrame = self.m_base_instance | |
| 4319 | local camera = self.camera | |
| 4320 | local mouse = self.mouse | |
| 4321 | local cameraCFrame = CFrame.new(camera.CoordinateFrame.p, camera.Focus.p) -- camera.CoordinateFrame | |
| 4322 | local viewSizeX, viewSizeY = mouse.ViewSizeX, mouse.ViewSizeY | |
| 4323 | local previousViewSize = self.viewSize | |
| 4324 | if not previousViewSize or ((viewSizeX ~= 0 or viewSizeY ~= 0) and (viewSizeX ~= previousViewSize.X or viewSizeY ~= previousViewSize.Y)) then | |
| 4325 | self.viewSize = {X = viewSizeX, Y = viewSizeY}
| |
| 4326 | local viewSizeUDim2 = UDim2.new(0, viewSizeX, 0, viewSizeY) | |
| 4327 | billboardGui.Size = viewSizeUDim2 | |
| 4328 | guiFrame.Size = viewSizeUDim2 | |
| 4329 | -- FIXME: | |
| 4330 | -- After the 15th of July 2014, there came an offset at the Y thingy out of nowhere so I accomodated for that. | |
| 4331 | billboardGui.SizeOffset = Vector2.new(0.5 / viewSizeX, (0.5 + 10) / viewSizeY) | |
| 4332 | end | |
| 4333 | --billboardGui.SizeOffset = Vector2.new() | |
| 4334 | billboardGui.StudsOffset = (cameraCFrame - cameraCFrame.p):inverse() * cameraCFrame.p - Vector3.new(0, 0, 1) | |
| 4335 | end | |
| 4336 | GuiService = GuiServiceClass:new {
| |
| 4337 | Camera = Camera, | |
| 4338 | Mouse = Mouse | |
| 4339 | } | |
| 4340 | GuiFrame = setmetatable({}, GuiObject)
| |
| 4341 | GuiFrame.__index = GuiFrame | |
| 4342 | GuiFrame.__default = {__index = {
| |
| 4343 | Active = false, | |
| 4344 | BackgroundTransparency = 0.75, | |
| 4345 | BorderSize = 4, | |
| 4346 | BorderTransparency = 0.75, | |
| 4347 | Color = AdvancedGUI.GUI_BASE_COLOR, | |
| 4348 | Position = UDim2.new(0, 0, 0, 0), | |
| 4349 | Size = UDim2.new(0, 52, 0, 52), | |
| 4350 | Visible = true | |
| 4351 | }} | |
| 4352 | function GuiFrame:Destroy() | |
| 4353 | GuiObject.Destroy(self) | |
| 4354 | end | |
| 4355 | function GuiFrame:GetContentInstance() | |
| 4356 | return self.m_content_frame | |
| 4357 | end | |
| 4358 | function GuiFrame:Init(data) | |
| 4359 | GuiObject.Init(self) | |
| 4360 | setmetatable(data, GuiFrame.__default) | |
| 4361 | local leftBorderFrameLeft = RBXInstance.new "Frame" {
| |
| 4362 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 4363 | BorderSizePixel = 0, | |
| 4364 | Size = UDim2.new(0, 1, 1, -1) | |
| 4365 | } | |
| 4366 | local leftBorderFrameCenter = RBXInstance.new "Frame" {
| |
| 4367 | BackgroundColor3 = Color3.new(1, 1, 1), | |
| 4368 | BorderSizePixel = 0, | |
| 4369 | Position = UDim2.new(0, 1, 0, 1) | |
| 4370 | } | |
| 4371 | local leftBorderFrameRight = RBXInstance.new "Frame" {
| |
| 4372 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 4373 | BorderSizePixel = 0 | |
| 4374 | } | |
| 4375 | local rightBorderFrameRight = RBXInstance.new "Frame" {
| |
| 4376 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 4377 | BorderSizePixel = 0, | |
| 4378 | Position = UDim2.new(1, -1, 0, 1), | |
| 4379 | Size = UDim2.new(0, 1, 1, -1) | |
| 4380 | } | |
| 4381 | local rightBorderFrameCenter = RBXInstance.new "Frame" {
| |
| 4382 | BackgroundColor3 = Color3.new(1, 1, 1), | |
| 4383 | BorderSizePixel = 0 | |
| 4384 | } | |
| 4385 | local rightBorderFrameLeft = RBXInstance.new "Frame" {
| |
| 4386 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 4387 | BorderSizePixel = 0 | |
| 4388 | } | |
| 4389 | local bottomBorderFrameBottom = RBXInstance.new "Frame" {
| |
| 4390 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 4391 | BorderSizePixel = 0, | |
| 4392 | Position = UDim2.new(0, 0, 1, -1), | |
| 4393 | Size = UDim2.new(1, -1, 0, 1) | |
| 4394 | } | |
| 4395 | local bottomBorderFrameCenter = RBXInstance.new "Frame" {
| |
| 4396 | BackgroundColor3 = Color3.new(1, 1, 1), | |
| 4397 | BorderSizePixel = 0 | |
| 4398 | } | |
| 4399 | local bottomBorderFrameTop = RBXInstance.new "Frame" {
| |
| 4400 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 4401 | BorderSizePixel = 0 | |
| 4402 | } | |
| 4403 | local topBorderFrameTop = RBXInstance.new "Frame" {
| |
| 4404 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 4405 | BorderSizePixel = 0, | |
| 4406 | Position = UDim2.new(0, 1, 0, 0), | |
| 4407 | Size = UDim2.new(1, -1, 0, 1) | |
| 4408 | } | |
| 4409 | local topBorderFrameCenter = RBXInstance.new "Frame" {
| |
| 4410 | BackgroundColor3 = Color3.new(1, 1, 1), | |
| 4411 | BorderSizePixel = 0 | |
| 4412 | } | |
| 4413 | local topBorderFrameBottom = RBXInstance.new "Frame" {
| |
| 4414 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 4415 | BorderSizePixel = 0 | |
| 4416 | } | |
| 4417 | local border_frame = RBXInstance.new "Frame" {
| |
| 4418 | BackgroundTransparency = 1, | |
| 4419 | Size = UDim2.new(1, 0, 1, 0), | |
| 4420 | leftBorderFrameLeft, | |
| 4421 | leftBorderFrameCenter, | |
| 4422 | leftBorderFrameRight, | |
| 4423 | rightBorderFrameLeft, | |
| 4424 | rightBorderFrameCenter, | |
| 4425 | rightBorderFrameRight, | |
| 4426 | bottomBorderFrameBottom, | |
| 4427 | bottomBorderFrameCenter, | |
| 4428 | bottomBorderFrameTop, | |
| 4429 | topBorderFrameBottom, | |
| 4430 | topBorderFrameCenter, | |
| 4431 | topBorderFrameTop | |
| 4432 | } | |
| 4433 | local contentFrame = RBXInstance.new "Frame" {
| |
| 4434 | BackgroundTransparency = 1, | |
| 4435 | BorderSizePixel = 0, | |
| 4436 | ClipsDescendants = true, | |
| 4437 | Size = UDim2.new(1, 0, 1, 0) | |
| 4438 | } | |
| 4439 | local base_frame = RBXInstance.new "Frame" {
| |
| 4440 | BorderSizePixel = 0, | |
| 4441 | border_frame, | |
| 4442 | contentFrame | |
| 4443 | } | |
| 4444 | self.m_base_instance = base_frame | |
| 4445 | self.m_content_frame = contentFrame | |
| 4446 | self.m_border_frame = border_frame | |
| 4447 | self.leftBorderFrameLeft = leftBorderFrameLeft | |
| 4448 | self.leftBorderFrameCenter = leftBorderFrameCenter | |
| 4449 | self.leftBorderFrameRight = leftBorderFrameRight | |
| 4450 | self.rightBorderFrameLeft = rightBorderFrameLeft | |
| 4451 | self.rightBorderFrameCenter = rightBorderFrameCenter | |
| 4452 | self.rightBorderFrameRight = rightBorderFrameRight | |
| 4453 | self.bottomBorderFrameBottom = bottomBorderFrameBottom | |
| 4454 | self.bottomBorderFrameCenter = bottomBorderFrameCenter | |
| 4455 | self.bottomBorderFrameTop = bottomBorderFrameTop | |
| 4456 | self.topBorderFrameBottom = topBorderFrameBottom | |
| 4457 | self.topBorderFrameCenter = topBorderFrameCenter | |
| 4458 | self.topBorderFrameTop = topBorderFrameTop | |
| 4459 | self:SetActive(data.Active) | |
| 4460 | self:SetBackgroundTransparency(data.BackgroundTransparency) | |
| 4461 | self:SetBorderSize(data.BorderSize) | |
| 4462 | self:SetBorderTransparency(data.BorderTransparency) | |
| 4463 | self:SetColor(data.Color) | |
| 4464 | self:SetPosition(data.Position) | |
| 4465 | self:SetSize(data.Size) | |
| 4466 | self:SetVisible(data.Visible) | |
| 4467 | self:SetParent(data.Parent) | |
| 4468 | end | |
| 4469 | function GuiFrame:IsA(className) | |
| 4470 | return className == "GuiFrame" or GuiObject.IsA(self, className) | |
| 4471 | end | |
| 4472 | function GuiFrame:SetBorderSize(border_size) | |
| 4473 | border_size = math.max(math.floor(border_size + 0.5), 0) | |
| 4474 | if border_size ~= self.m_border_size then | |
| 4475 | self.m_border_size = border_size | |
| 4476 | local border_frame = self.m_border_frame | |
| 4477 | local contentFrame = self.m_content_frame | |
| 4478 | local leftBorderFrameCenter = self.leftBorderFrameCenter | |
| 4479 | local leftBorderFrameRight = self.leftBorderFrameRight | |
| 4480 | local rightBorderFrameCenter = self.rightBorderFrameCenter | |
| 4481 | local rightBorderFrameLeft = self.rightBorderFrameLeft | |
| 4482 | local bottomBorderFrameCenter = self.bottomBorderFrameCenter | |
| 4483 | local bottomBorderFrameTop = self.bottomBorderFrameTop | |
| 4484 | local topBorderFrameCenter = self.topBorderFrameCenter | |
| 4485 | local topBorderFrameBottom = self.topBorderFrameBottom | |
| 4486 | contentFrame.Position = UDim2.new(0, border_size, 0, border_size) | |
| 4487 | contentFrame.Size = UDim2.new(1, -2 * border_size, 1, -2 * border_size) | |
| 4488 | local inner_visible = border_size > 0 | |
| 4489 | if self.leftBorderFrameLeft.Visible ~= inner_visible then | |
| 4490 | self.rightBorderFrameRight.Visible = inner_visible | |
| 4491 | self.bottomBorderFrameBottom.Visible = inner_visible | |
| 4492 | self.topBorderFrameTop.Visible = inner_visible | |
| 4493 | end | |
| 4494 | local outer_visible = border_size > 1 | |
| 4495 | if leftBorderFrameCenter.Visible ~= outer_visible then | |
| 4496 | leftBorderFrameCenter.Visible = outer_visible | |
| 4497 | leftBorderFrameRight.Visible = outer_visible | |
| 4498 | rightBorderFrameCenter.Visible = outer_visible | |
| 4499 | rightBorderFrameLeft.Visible = outer_visible | |
| 4500 | bottomBorderFrameCenter.Visible = outer_visible | |
| 4501 | bottomBorderFrameTop.Visible = outer_visible | |
| 4502 | topBorderFrameCenter.Visible = outer_visible | |
| 4503 | topBorderFrameBottom.Visible = outer_visible | |
| 4504 | end | |
| 4505 | if outer_visible then | |
| 4506 | leftBorderFrameCenter.Size = UDim2.new(0, border_size - 2, 1, -border_size) | |
| 4507 | leftBorderFrameRight.Position = UDim2.new(0, border_size - 1, 0, border_size - 1) | |
| 4508 | leftBorderFrameRight.Size = UDim2.new(0, 1, 1, 1 - 2 * border_size) | |
| 4509 | rightBorderFrameCenter.Position = UDim2.new(1, 1 - border_size, 0, border_size - 1) | |
| 4510 | rightBorderFrameCenter.Size = UDim2.new(0, border_size - 2, 1, -border_size) | |
| 4511 | rightBorderFrameLeft.Position = UDim2.new(1, -border_size, 0, border_size) | |
| 4512 | rightBorderFrameLeft.Size = UDim2.new(0, 1, 1, 1 - 2 * border_size) | |
| 4513 | bottomBorderFrameCenter.Position = UDim2.new(0, 1, 1, 1 - border_size) | |
| 4514 | bottomBorderFrameCenter.Size = UDim2.new(1, -border_size, 0, border_size - 2) | |
| 4515 | bottomBorderFrameTop.Position = UDim2.new(0, border_size - 1, 1, -border_size) | |
| 4516 | bottomBorderFrameTop.Size = UDim2.new(1, 1 - 2 * border_size, 0, 1) | |
| 4517 | topBorderFrameCenter.Position = UDim2.new(0, border_size - 1, 0, 1) | |
| 4518 | topBorderFrameCenter.Size = UDim2.new(1, -border_size, 0, border_size - 2) | |
| 4519 | topBorderFrameBottom.Position = UDim2.new(0, border_size, 0, border_size - 1) | |
| 4520 | topBorderFrameBottom.Size = UDim2.new(1, 1 - 2 * border_size, 0, 1) | |
| 4521 | end | |
| 4522 | end | |
| 4523 | end | |
| 4524 | function GuiFrame:SetBorderTransparency(borderTransparency) | |
| 4525 | self.borderTransparency = borderTransparency | |
| 4526 | self.leftBorderFrameLeft.BackgroundTransparency = borderTransparency | |
| 4527 | self.leftBorderFrameCenter.BackgroundTransparency = borderTransparency | |
| 4528 | self.leftBorderFrameRight.BackgroundTransparency = borderTransparency | |
| 4529 | self.rightBorderFrameLeft.BackgroundTransparency = borderTransparency | |
| 4530 | self.rightBorderFrameCenter.BackgroundTransparency = borderTransparency | |
| 4531 | self.rightBorderFrameRight.BackgroundTransparency = borderTransparency | |
| 4532 | self.bottomBorderFrameBottom.BackgroundTransparency = borderTransparency | |
| 4533 | self.bottomBorderFrameCenter.BackgroundTransparency = borderTransparency | |
| 4534 | self.bottomBorderFrameTop.BackgroundTransparency = borderTransparency | |
| 4535 | self.topBorderFrameBottom.BackgroundTransparency = borderTransparency | |
| 4536 | self.topBorderFrameCenter.BackgroundTransparency = borderTransparency | |
| 4537 | self.topBorderFrameTop.BackgroundTransparency = borderTransparency | |
| 4538 | end | |
| 4539 | GuiButton = setmetatable({}, GuiFrame)
| |
| 4540 | GuiButton.__index = GuiButton | |
| 4541 | GuiButton.__default = {__index = {
| |
| 4542 | AutoButtonColor = true | |
| 4543 | }} | |
| 4544 | function GuiButton:Destroy() | |
| 4545 | self.Activated:disconnect() | |
| 4546 | GuiFrame.Destroy(self) | |
| 4547 | end | |
| 4548 | function GuiButton:Init(data) | |
| 4549 | if data.Active == nil then | |
| 4550 | data.Active = true | |
| 4551 | end | |
| 4552 | GuiFrame.Init(self, data) | |
| 4553 | setmetatable(data, GuiButton.__default) | |
| 4554 | self.Activated = RbxUtility.CreateSignal() | |
| 4555 | self:SetAutoButtonColor(data.AutoButtonColor) | |
| 4556 | end | |
| 4557 | function GuiButton:IsA(className) | |
| 4558 | return className == "GuiButton" or GuiFrame.IsA(self, className) | |
| 4559 | end | |
| 4560 | function GuiButton:SetAutoButtonColor(autoButtonColor) | |
| 4561 | if autoButtonColor ~= self.autoButtonColor then | |
| 4562 | self.autoButtonColor = autoButtonColor | |
| 4563 | if autoButtonColor then | |
| 4564 | if self.mouseOver then | |
| 4565 | local color = self.color | |
| 4566 | local transparency = self.backgroundTransparency | |
| 4567 | if self.mouseDown then | |
| 4568 | self.m_base_instance.BackgroundColor3 = Color3.new(math.min(color.r + 0.3, 1), math.min(color.g + 0.3, 1), math.min(color.b + 0.3, 1)) | |
| 4569 | self.m_base_instance.BackgroundTransparency = transparency | |
| 4570 | else | |
| 4571 | self.m_base_instance.BackgroundColor3 = Color3.new(math.max(color.r - 0.3, 0), math.max(color.g - 0.3, 0), math.max(color.b - 0.3, 0)) | |
| 4572 | self.m_base_instance.BackgroundTransparency = math.max(0, transparency - 0.5) | |
| 4573 | end | |
| 4574 | end | |
| 4575 | else | |
| 4576 | self.m_base_instance.BackgroundColor3 = self.color | |
| 4577 | end | |
| 4578 | end | |
| 4579 | end | |
| 4580 | GuiTextLabel = setmetatable({}, GuiFrame)
| |
| 4581 | GuiTextLabel.__index = GuiTextLabel | |
| 4582 | GuiTextLabel.__default = {__index = {
| |
| 4583 | Font = "ArialBold", | |
| 4584 | FontSize = "Size12", | |
| 4585 | Text = "", | |
| 4586 | TextColor = Color3.new(1, 1, 1), | |
| 4587 | TextStrokeColor = Color3.new(0, 0, 0), | |
| 4588 | TextStrokeTransparency = 0.6, | |
| 4589 | TextWrapped = true | |
| 4590 | }} | |
| 4591 | function GuiTextLabel:Destroy() | |
| 4592 | GuiFrame.Destroy(self) | |
| 4593 | end | |
| 4594 | function GuiTextLabel:Init(data) | |
| 4595 | GuiFrame.Init(self, data) | |
| 4596 | setmetatable(data, GuiTextLabel.__default) | |
| 4597 | local base_instance = self.m_base_instance | |
| 4598 | local textLabel = RBXInstance.new "TextLabel" {
| |
| 4599 | BackgroundTransparency = 1, | |
| 4600 | Font = data.Font, | |
| 4601 | FontSize = data.FontSize, | |
| 4602 | TextColor3 = data.TextColor3, | |
| 4603 | TextStrokeColor3 = data.TextStrokeColor3, | |
| 4604 | TextStrokeTransparency = data.TextStrokeTransparency, | |
| 4605 | TextWrapped = data.TextWrapped | |
| 4606 | } | |
| 4607 | textLabel.Parent = self:GetContentInstance() | |
| 4608 | self.textLabel = textLabel | |
| 4609 | self:SetText(data.Text) | |
| 4610 | end | |
| 4611 | function GuiTextLabel:IsA(className) | |
| 4612 | return className == "GuiTextLabel" or GuiFrame.IsA(self, className) | |
| 4613 | end | |
| 4614 | function GuiTextLabel:SetText(text) | |
| 4615 | if text ~= self.text then | |
| 4616 | self.text = text | |
| 4617 | local text_index = 1 | |
| 4618 | local content_instance = self:GetContentInstance() | |
| 4619 | local content_instance_size = content_instance.AbsoluteSize | |
| 4620 | local frame = Instance.new("Frame")
| |
| 4621 | frame.BackgroundTransparency = 1 | |
| 4622 | local label = Instance.new("TextLabel")
| |
| 4623 | label.BackgroundTransparency = 1 | |
| 4624 | label.Font = font | |
| 4625 | label.FontSize = fontSize | |
| 4626 | label.Size = UDim2.new(0, content_instance_size.X, 0, 1000) | |
| 4627 | label.Text = "" | |
| 4628 | label.TextColor3 = textColor3 | |
| 4629 | label.TextTransparency = 1 | |
| 4630 | label.TextWrapped = true | |
| 4631 | label.TextXAlignment = textXAlignment | |
| 4632 | label.TextYAlignment = textYAlignment | |
| 4633 | label.Parent = self.guiFrame | |
| 4634 | local row_length = 0 | |
| 4635 | local step_size = 256 | |
| 4636 | for step = 1, 8 do | |
| 4637 | step_size = 0.5 * step_size | |
| 4638 | label.Text = string.sub(text, text_index, text_index + row_length - 1) | |
| 4639 | end | |
| 4640 | end | |
| 4641 | end | |
| 4642 | GuiImageButton = setmetatable({}, GuiButton)
| |
| 4643 | GuiImageButton.__index = GuiImageButton | |
| 4644 | GuiImageButton.__default = {__index = {
| |
| 4645 | Image = "" | |
| 4646 | }} | |
| 4647 | function GuiImageButton:Destroy() | |
| 4648 | GuiButton.Destroy(self) | |
| 4649 | end | |
| 4650 | function GuiImageButton:Init(data) | |
| 4651 | GuiButton.Init(self, data) | |
| 4652 | setmetatable(data, GuiImageButton.__default) | |
| 4653 | local content_frame = self.m_content_frame | |
| 4654 | local image_label = RBXInstance.new "ImageLabel" {
| |
| 4655 | BackgroundTransparency = 1, | |
| 4656 | Size = UDim2.new(1, 0, 1, 0) | |
| 4657 | } | |
| 4658 | image_label.Parent = content_frame | |
| 4659 | self.m_image_label = image_label | |
| 4660 | self:SetImage(data.Image) | |
| 4661 | end | |
| 4662 | function GuiImageButton:IsA(className) | |
| 4663 | return className == "GuiImageButton" or GuiButton.IsA(self, className) | |
| 4664 | end | |
| 4665 | function GuiImageButton:SetImage(image) | |
| 4666 | if image ~= self.m_image then | |
| 4667 | self.m_image = image | |
| 4668 | self.m_image_label.Image = image | |
| 4669 | end | |
| 4670 | end | |
| 4671 | GuiTextButton = setmetatable({}, GuiButton)
| |
| 4672 | GuiTextButton.__index = GuiTextButton | |
| 4673 | GuiTextButton.__default = {__index = {
| |
| 4674 | Font = Enum.Font.ArialBold, | |
| 4675 | FontSize = Enum.FontSize.Size11, | |
| 4676 | Text = "Button", | |
| 4677 | TextXAlignment = Enum.TextXAlignment.Center | |
| 4678 | }} | |
| 4679 | function GuiTextButton:Destroy() | |
| 4680 | GuiButton.Destroy(self) | |
| 4681 | end | |
| 4682 | function GuiTextButton:GetTextBounds() | |
| 4683 | return self.textLabel.TextBounds | |
| 4684 | end | |
| 4685 | function GuiTextButton:Init(data) | |
| 4686 | GuiButton.Init(self, data) | |
| 4687 | setmetatable(data, GuiTextButton.__default) | |
| 4688 | local contentFrame = self.m_content_frame | |
| 4689 | local mnemonicLabel = RBXInstance.new "TextLabel" {
| |
| 4690 | BackgroundTransparency = 1, | |
| 4691 | Font = "ArialBold", | |
| 4692 | FontSize = "Size36", | |
| 4693 | Size = UDim2.new(1, 0, 0.7, 0), | |
| 4694 | TextColor3 = Color3.new(1, 1, 1), | |
| 4695 | TextStrokeColor3 = Color3.new(0, 0, 0), | |
| 4696 | TextStrokeTransparency = 0.6, | |
| 4697 | TextWrapped = true | |
| 4698 | } | |
| 4699 | local textLabel = RBXInstance.new "TextLabel" {
| |
| 4700 | BackgroundTransparency = 1, | |
| 4701 | TextColor3 = Color3.new(1, 1, 1), | |
| 4702 | TextStrokeColor3 = Color3.new(0, 0, 0), | |
| 4703 | TextStrokeTransparency = 0.6, | |
| 4704 | TextWrapped = true | |
| 4705 | } | |
| 4706 | mnemonicLabel.Parent = contentFrame | |
| 4707 | textLabel.Parent = contentFrame | |
| 4708 | self.mnemonicLabel = mnemonicLabel | |
| 4709 | self.textLabel = textLabel | |
| 4710 | self:SetFont(data.Font) | |
| 4711 | self:SetFontSize(data.FontSize) | |
| 4712 | self:SetMnemonic(data.Mnemonic, true) | |
| 4713 | self:SetText(data.Text) | |
| 4714 | self:SetTextXAlignment(data.TextXAlignment) | |
| 4715 | end | |
| 4716 | function GuiTextButton:IsA(className) | |
| 4717 | return className == "GuiTextButton" or GuiButton.IsA(self, className) | |
| 4718 | end | |
| 4719 | function GuiTextButton:SetFont(font) | |
| 4720 | if font ~= self.font then | |
| 4721 | self.font = font | |
| 4722 | self.textLabel.Font = font | |
| 4723 | end | |
| 4724 | end | |
| 4725 | function GuiTextButton:SetFontSize(fontSize) | |
| 4726 | if fontSize ~= self.fontSize then | |
| 4727 | self.fontSize = fontSize | |
| 4728 | self.textLabel.FontSize = fontSize | |
| 4729 | end | |
| 4730 | end | |
| 4731 | function GuiTextButton:SetMnemonic(mnemonic, forceUpdate) | |
| 4732 | if mnemonic ~= self.mnemonic or forceUpdate then | |
| 4733 | if self.mnemonic then | |
| 4734 | GuiService:SetMnemonic(self.mnemonic, nil) | |
| 4735 | end | |
| 4736 | if mnemonic then | |
| 4737 | GuiService:SetMnemonic(mnemonic, self) | |
| 4738 | end | |
| 4739 | self.mnemonic = mnemonic | |
| 4740 | local mnemonicLabel = self.mnemonicLabel | |
| 4741 | local textLabel = self.textLabel | |
| 4742 | if mnemonic then | |
| 4743 | mnemonicLabel.Text = mnemonic | |
| 4744 | textLabel.Size = UDim2.new(1, 0, 0.9, 0) | |
| 4745 | textLabel.TextYAlignment = "Bottom" | |
| 4746 | else | |
| 4747 | mnemonicLabel.Text = "" | |
| 4748 | textLabel.Size = UDim2.new(1, 0, 1, 0) | |
| 4749 | textLabel.TextYAlignment = "Center" | |
| 4750 | end | |
| 4751 | end | |
| 4752 | end | |
| 4753 | function GuiTextButton:SetText(text) | |
| 4754 | if text ~= self.text then | |
| 4755 | self.text = text | |
| 4756 | self.textLabel.Text = text | |
| 4757 | end | |
| 4758 | end | |
| 4759 | function GuiTextButton:SetTextXAlignment(textXAlignment) | |
| 4760 | if textXAlignment ~= self.textXAlignment then | |
| 4761 | self.textXAlignment = textXAlignment | |
| 4762 | self.textLabel.TextXAlignment = textXAlignment | |
| 4763 | end | |
| 4764 | end | |
| 4765 | GuiWindow = setmetatable({}, GuiObject)
| |
| 4766 | GuiWindow.__index = GuiWindow | |
| 4767 | GuiWindow.__default = {__index = {
| |
| 4768 | Active = true, | |
| 4769 | BackgroundTransparency = 0.5, | |
| 4770 | BorderSize = 4, | |
| 4771 | BorderTransparency = 0.5, | |
| 4772 | Position = UDim2.new(0, 0, 0, 0), | |
| 4773 | Size = UDim2.new(0, 360, 0, 240), | |
| 4774 | Title = "Window", | |
| 4775 | TitleBarBackgroundTransparency = 0.5, | |
| 4776 | TitleBarBorderTransparency = 1, | |
| 4777 | Visible = true | |
| 4778 | }} | |
| 4779 | function GuiWindow:Init(data) | |
| 4780 | GuiObject.Init(self) | |
| 4781 | setmetatable(data, GuiFrame.__default) | |
| 4782 | local title_bar = GuiTextLabel:new {
| |
| 4783 | BackgroundTransparency = data.TitleBarBackgroundTransparency, | |
| 4784 | BorderTransparency = data.TitleBarBackgroundTransparency, | |
| 4785 | Text = data.Title | |
| 4786 | } | |
| 4787 | local content_frame = GuiFrame:new {
| |
| 4788 | Active = data.Active, | |
| 4789 | BackgroundTransparency = data.BackgroundTransparency, | |
| 4790 | BorderSize = data.BorderSize, | |
| 4791 | BorderTransparency = data.BorderTransparency | |
| 4792 | } | |
| 4793 | local base_frame = RBXInstance.new "Frame" {
| |
| 4794 | BackgroundTransparency = 1, | |
| 4795 | BorderSizePixel = 0, | |
| 4796 | Position = data.Position, | |
| 4797 | Size = data.Size, | |
| 4798 | Visible = data.Visible | |
| 4799 | } | |
| 4800 | self.m_base_frame = base_frame | |
| 4801 | self.m_content_frame = content_frame | |
| 4802 | self.m_title_bar = title_bar | |
| 4803 | end | |
| 4804 | function GuiWindow:IsA(className) | |
| 4805 | return className == "GuiWindow" or GuiObject.IsA(self, className) | |
| 4806 | end | |
| 4807 | GuiScrollFrame = setmetatable({}, GuiFrame)
| |
| 4808 | GuiScrollFrame.__index = GuiScrollFrame | |
| 4809 | GuiScrollFrame.__default = {__index = {
| |
| 4810 | ContentHeight = 0, | |
| 4811 | ScrollBarColor = Color3.new(1, 1, 1) | |
| 4812 | }} | |
| 4813 | function GuiScrollFrame:Destroy() | |
| 4814 | self.m_scroll_bar:Destroy() | |
| 4815 | GuiFrame.Destroy(self) | |
| 4816 | end | |
| 4817 | function GuiScrollFrame:GetContentInstance() | |
| 4818 | return self.m_scroll_frame or GuiFrame.GetContentInstance(self) | |
| 4819 | end | |
| 4820 | function GuiScrollFrame:Init(data) | |
| 4821 | GuiFrame.Init(self, data) | |
| 4822 | setmetatable(data, GuiScrollFrame.__default) | |
| 4823 | local scroll_pane = RBXInstance.new "Frame" {
| |
| 4824 | BackgroundColor3 = Color3.new(1, 1, 1), | |
| 4825 | BackgroundTransparency = 0.8, | |
| 4826 | BorderSizePixel = 0, | |
| 4827 | Position = UDim2.new(1, -20, 0, 0), | |
| 4828 | Size = UDim2.new(0, 20, 1, 0), | |
| 4829 | Parent = self.m_content_frame | |
| 4830 | } | |
| 4831 | local scroll_bar = GuiFrame:new {
| |
| 4832 | Active = true, | |
| 4833 | BackgroundTransparency = 0.6, | |
| 4834 | BorderTransparency = 0.6, | |
| 4835 | Color = data.ScrollBarColor, | |
| 4836 | Parent = self | |
| 4837 | } | |
| 4838 | local scroll_frame = RBXInstance.new "Frame" {
| |
| 4839 | BackgroundTransparency = 1, | |
| 4840 | Parent = self.m_content_frame | |
| 4841 | } | |
| 4842 | self.m_scroll_bar = scroll_bar | |
| 4843 | self.m_scroll_frame = scroll_frame | |
| 4844 | self.m_scroll_pane = scroll_pane | |
| 4845 | self.m_scroll_position = 0 | |
| 4846 | self.m_updating_content_height = false | |
| 4847 | self:SetContentHeight(data.ContentHeight) | |
| 4848 | self:UpdateScrollPosition() | |
| 4849 | self.m_scroll_bar.DragBegin:connect(function() | |
| 4850 | self.m_scroll_drag_total = Vector2.new() | |
| 4851 | self.m_scroll_initial_position = self.m_scroll_position | |
| 4852 | end) | |
| 4853 | self.m_scroll_bar.DragMove:connect(function(offset) | |
| 4854 | self.m_scroll_drag_total = self.m_scroll_drag_total + offset | |
| 4855 | local absolute_height = self:GetAbsoluteSize().Y - 2 * self.m_border_size | |
| 4856 | if absolute_height ~= 0 then | |
| 4857 | local content_height = math.max(self.m_content_height, absolute_height) | |
| 4858 | local scroll_space = 1 - absolute_height / content_height | |
| 4859 | self:Scroll(self.m_scroll_initial_position + self.m_scroll_drag_total.Y * (content_height / absolute_height - 1) / scroll_space) | |
| 4860 | end | |
| 4861 | end) | |
| 4862 | end | |
| 4863 | function GuiScrollFrame:IsA(className) | |
| 4864 | return className == "GuiScrollFrame" or GuiFrame.IsA(self, className) | |
| 4865 | end | |
| 4866 | function GuiScrollFrame:Scroll(position) | |
| 4867 | position = math.min(math.max(position, 0), self.m_content_height - (self:GetAbsoluteSize().Y - 2 * self.m_border_size)) | |
| 4868 | if position ~= self.m_scroll_position then | |
| 4869 | self.m_scroll_position = position | |
| 4870 | self:UpdateScrollPosition() | |
| 4871 | end | |
| 4872 | end | |
| 4873 | function GuiScrollFrame:SetContentHeight(height) | |
| 4874 | if height ~= self.m_content_height then | |
| 4875 | local prev_height = self.m_content_height | |
| 4876 | self.m_content_height = height | |
| 4877 | if not self.m_updating_content_height then | |
| 4878 | self.m_updating_content_height = true | |
| 4879 | coroutine.resume(coroutine.create(function() | |
| 4880 | local success, message = ypcall(self.SetContentHeightImpl1, self, prev_height) | |
| 4881 | if not success then | |
| 4882 | Logger.printf("Severe", "Error in GuiScrollFrame:SetContentHeight(%s): %s", Utility.ToString(height), message)
| |
| 4883 | end | |
| 4884 | end)) | |
| 4885 | end | |
| 4886 | end | |
| 4887 | end | |
| 4888 | function GuiScrollFrame:SetContentHeightImpl1(prev_height) | |
| 4889 | RunService.RenderStepped:wait() | |
| 4890 | self.m_updating_content_height = false | |
| 4891 | local height = self.m_content_height | |
| 4892 | self.m_scroll_frame.Size = UDim2.new(1, -20, 0, height) | |
| 4893 | if prev_height and prev_height ~= 0 then | |
| 4894 | local absolute_height = self:GetAbsoluteSize().Y - 2 * self.m_border_size | |
| 4895 | if self.m_scroll_position == prev_height - absolute_height then | |
| 4896 | self.m_scroll_position = height - absolute_height | |
| 4897 | else | |
| 4898 | self.m_scroll_position = height * self.m_scroll_position / prev_height | |
| 4899 | end | |
| 4900 | end | |
| 4901 | self:UpdateScrollPosition() | |
| 4902 | end | |
| 4903 | function GuiScrollFrame:UpdateScrollPosition() | |
| 4904 | local absolute_height = self:GetAbsoluteSize().Y - 2 * self.m_border_size | |
| 4905 | if absolute_height == 0 then | |
| 4906 | absolute_height = self.m_content_height | |
| 4907 | end | |
| 4908 | local scroll_bar = self.m_scroll_bar | |
| 4909 | local scroll_frame = self.m_scroll_frame | |
| 4910 | local scroll_pane = self.m_scroll_pane | |
| 4911 | local content_height = math.max(self.m_content_height, absolute_height) | |
| 4912 | if absolute_height == content_height then | |
| 4913 | scroll_frame.Position = UDim2.new(0, 0, 0, 0) | |
| 4914 | scroll_frame.Size = UDim2.new(1, 0, 1, 0) | |
| 4915 | scroll_bar:SetVisible(false) | |
| 4916 | scroll_pane.Visible = false | |
| 4917 | else | |
| 4918 | local contentScale = content_height / absolute_height | |
| 4919 | local scroll_space = 1 - absolute_height / content_height | |
| 4920 | local scroll_position = self.m_scroll_position | |
| 4921 | scroll_frame.Position = UDim2.new(0, 0, 0, -scroll_position) | |
| 4922 | scroll_bar:SetPosition(UDim2.new(1, -20, scroll_position / (content_height - absolute_height) * scroll_space, 0)) | |
| 4923 | scroll_bar:SetSize(UDim2.new(0, 20, absolute_height / content_height, 0)) | |
| 4924 | scroll_bar:SetVisible(true) | |
| 4925 | scroll_pane.Visible = true | |
| 4926 | end | |
| 4927 | end | |
| 4928 | GuiMenu = setmetatable({}, GuiFrame)
| |
| 4929 | GuiMenu.__index = GuiMenu | |
| 4930 | GuiMenu.__default = {__index = {
| |
| 4931 | VerticalSpacing = 18 | |
| 4932 | }} | |
| 4933 | function GuiMenu:AddItem(text, onClick, options) | |
| 4934 | local frameSize = self:GetSize() | |
| 4935 | local frameHeight = frameSize.Y.Offset - self.m_border_size * 2 | |
| 4936 | local verticalSpacing = self.verticalSpacing | |
| 4937 | local properties = {
| |
| 4938 | BackgroundTransparency = 0.75, | |
| 4939 | BorderSize = 0, | |
| 4940 | BorderTransparency = 1, | |
| 4941 | Color = (#self.menuItems % 2 == 1) and Color3.new(0.25, 0.25, 0.25) or Color3.new(0, 0, 0), | |
| 4942 | FontSize = Enum.FontSize.Size12, | |
| 4943 | Position = UDim2.new(0, 0, 0, frameHeight), | |
| 4944 | Size = UDim2.new(1, 0, 0, verticalSpacing), | |
| 4945 | Text = text, | |
| 4946 | Parent = self | |
| 4947 | } | |
| 4948 | if options then | |
| 4949 | for key, value in pairs(options) do | |
| 4950 | properties[key] = value | |
| 4951 | end | |
| 4952 | end | |
| 4953 | local menuItem = GuiTextButton:new(properties) | |
| 4954 | if onClick then | |
| 4955 | menuItem.Activated:connect(function() | |
| 4956 | if not onClick(text, self) then | |
| 4957 | self:Destroy() | |
| 4958 | end | |
| 4959 | end) | |
| 4960 | end | |
| 4961 | self.menuItems[#self.menuItems + 1] = menuItem | |
| 4962 | self:SetSize(frameSize + UDim2.new(0, 0, 0, verticalSpacing)) | |
| 4963 | end | |
| 4964 | function GuiMenu:ClearItems() | |
| 4965 | local menuItems = self.menuItems | |
| 4966 | for _, item in ipairs(menuItems) do | |
| 4967 | menuItems[item] = nil | |
| 4968 | item:Destroy() | |
| 4969 | end | |
| 4970 | local frameSize = self:GetSize() | |
| 4971 | self:SetSize(frameSize + UDim2.new(0, 0, 0, self.m_border_size * 2 - frameSize.Y.Offset)) | |
| 4972 | end | |
| 4973 | function GuiMenu:Destroy() | |
| 4974 | self:ClearItems() | |
| 4975 | GuiFrame.Destroy(self) | |
| 4976 | end | |
| 4977 | function GuiMenu:Init(data) | |
| 4978 | GuiFrame.Init(self, data) | |
| 4979 | setmetatable(data, GuiMenu.__default) | |
| 4980 | self.menuItems = {}
| |
| 4981 | self.verticalSpacing = data.VerticalSpacing | |
| 4982 | end | |
| 4983 | function GuiMenu:IsA(className) | |
| 4984 | return className == "GuiMenu" or GuiFrame.IsA(self, className) | |
| 4985 | end | |
| 4986 | GuiTextList = setmetatable({}, GuiScrollFrame)
| |
| 4987 | GuiTextList.__index = GuiTextList | |
| 4988 | GuiTextList.__default = {__index = {
| |
| 4989 | }} | |
| 4990 | function GuiTextList:AddItem(text, options) | |
| 4991 | local properties = {
| |
| 4992 | BackgroundTransparency = 1, | |
| 4993 | Font = "ArialBold", | |
| 4994 | FontSize = "Size12", | |
| 4995 | Position = UDim2.new(0, 4, 0, self.m_content_height), | |
| 4996 | Size = UDim2.new(1, -8, 0, 12), | |
| 4997 | Text = tostring(text), | |
| 4998 | TextColor3 = Color3.new(1, 1, 1), | |
| 4999 | TextStrokeTransparency = 0.6, | |
| 5000 | TextWrapped = true, | |
| 5001 | TextXAlignment = "Left", | |
| 5002 | Parent = self:GetContentInstance() | |
| 5003 | } | |
| 5004 | if options then | |
| 5005 | for key, value in pairs(options) do | |
| 5006 | properties[key] = value | |
| 5007 | end | |
| 5008 | end | |
| 5009 | local textLabel = RBXInstance.new "TextLabel" (properties) | |
| 5010 | textLabel.Size = UDim2.new(1, 0, 0, textLabel.TextBounds.Y) | |
| 5011 | self.listItems[#self.listItems + 1] = textLabel | |
| 5012 | self:SetContentHeight(self.m_content_height + textLabel.TextBounds.Y) | |
| 5013 | end | |
| 5014 | function GuiTextList:ClearItems() | |
| 5015 | local listItems = self.listItems | |
| 5016 | for _, item in ipairs(listItems) do | |
| 5017 | listItems[item] = nil | |
| 5018 | item:Destroy() | |
| 5019 | end | |
| 5020 | self:SetContentHeight(0) | |
| 5021 | end | |
| 5022 | function GuiTextList:Destroy() | |
| 5023 | self:ClearItems() | |
| 5024 | GuiScrollFrame.Destroy(self) | |
| 5025 | end | |
| 5026 | function GuiTextList:Init(data) | |
| 5027 | GuiScrollFrame.Init(self, data) | |
| 5028 | self.listItems = {}
| |
| 5029 | end | |
| 5030 | function GuiTextList:IsA(className) | |
| 5031 | return className == "GuiTextList" or GuiScrollFrame.IsA(self, className) | |
| 5032 | end | |
| 5033 | GuiNetworkList = setmetatable({}, GuiTextList)
| |
| 5034 | GuiNetworkList.__index = GuiNetworkList | |
| 5035 | function GuiNetworkList:AddItem(systemTime, idleTime, userName, isNil) | |
| 5036 | local frame = GuiFrame:new {
| |
| 5037 | BackgroundTransparency = 1, | |
| 5038 | BorderSize = 0, | |
| 5039 | BorderTransparency = 1, | |
| 5040 | Position = UDim2.new(0, 4, 0, self.m_content_height), | |
| 5041 | Size = UDim2.new(1, -8, 0, 14), | |
| 5042 | } | |
| 5043 | local systemTimeColor | |
| 5044 | if string.sub(systemTime, 1, 1) == "?" then | |
| 5045 | systemTimeColor = Color3.new(1, 0.75, 0.75) | |
| 5046 | else | |
| 5047 | systemTimeColor = Color3.new(0.75, 0.75, 1) | |
| 5048 | end | |
| 5049 | local systemTimeLabel = RBXInstance.new "TextLabel" {
| |
| 5050 | BackgroundTransparency = 1, | |
| 5051 | Font = "ArialBold", | |
| 5052 | FontSize = "Size12", | |
| 5053 | Position = UDim2.new(0, 0, 0, 0), | |
| 5054 | Size = UDim2.new(0, 50, 1, 0), | |
| 5055 | Text = systemTime, | |
| 5056 | TextColor3 = systemTimeColor, | |
| 5057 | TextStrokeTransparency = 0.6, | |
| 5058 | TextXAlignment = "Left", | |
| 5059 | Parent = frame:GetContentInstance() | |
| 5060 | } | |
| 5061 | local idle_time_color | |
| 5062 | if string.sub(idleTime, 1, 1) == "0" then | |
| 5063 | idle_time_color = Color3.new(1, 1, 1) | |
| 5064 | else | |
| 5065 | idle_time_color = Color3.new(1, 0.75, 0.75) | |
| 5066 | end | |
| 5067 | local idleTimeLabel = RBXInstance.new "TextLabel" {
| |
| 5068 | BackgroundTransparency = 1, | |
| 5069 | Font = "ArialBold", | |
| 5070 | FontSize = "Size12", | |
| 5071 | Position = UDim2.new(0, 40, 0, 0), | |
| 5072 | Size = UDim2.new(0, 45, 1, 0), | |
| 5073 | Text = idleTime, | |
| 5074 | TextColor3 = idle_time_color, | |
| 5075 | TextStrokeTransparency = 0.6, | |
| 5076 | TextXAlignment = "Right", | |
| 5077 | Parent = frame:GetContentInstance() | |
| 5078 | } | |
| 5079 | local userNameLabel = GuiTextButton:new {
| |
| 5080 | AutoButtonColor = false, | |
| 5081 | BackgroundTransparency = 1, | |
| 5082 | BorderSize = 0, | |
| 5083 | BorderTransparency = 1, | |
| 5084 | Font = Enum.Font.SourceSansBold, | |
| 5085 | FontSize = Enum.FontSize.Size14, | |
| 5086 | Position = UDim2.new(0, 98, 0, 0), | |
| 5087 | Size = UDim2.new(1, -98, 1, 0), | |
| 5088 | TextXAlignment = Enum.TextXAlignment.Left, | |
| 5089 | Text = userName, | |
| 5090 | Parent = frame | |
| 5091 | } | |
| 5092 | frame:SetParent(self) | |
| 5093 | local userNameWidth = userNameLabel:GetTextBounds().X | |
| 5094 | userNameLabel:SetSize(UDim2.new(0, userNameWidth + 4, 1, 0)) | |
| 5095 | if isNil then | |
| 5096 | local isNilLabel = RBXInstance.new "TextLabel" {
| |
| 5097 | BackgroundTransparency = 1, | |
| 5098 | Font = "SourceSans", | |
| 5099 | FontSize = "Size14", | |
| 5100 | Position = UDim2.new(0, 100 + userNameWidth + 8, 0, 0), | |
| 5101 | Size = UDim2.new(0, 50, 1, 0), | |
| 5102 | Text = "(nil)", | |
| 5103 | TextColor3 = Color3.new(1, 0.4, 0.4), | |
| 5104 | TextStrokeTransparency = 0.6, | |
| 5105 | TextXAlignment = "Left", | |
| 5106 | Parent = frame:GetContentInstance() | |
| 5107 | } | |
| 5108 | end | |
| 5109 | self.listItems[#self.listItems + 1] = frame | |
| 5110 | self:SetContentHeight(self.m_content_height + 14) | |
| 5111 | end | |
| 5112 | function GuiNetworkList:IsA(className) | |
| 5113 | return className == "GuiNetworkList" or GuiTextList.IsA(self, className) | |
| 5114 | end | |
| 5115 | GuiTextOutput = setmetatable({}, GuiScrollFrame)
| |
| 5116 | GuiTextOutput.__index = GuiTextOutput | |
| 5117 | GuiTextOutput.__default = {__index = {
| |
| 5118 | DisplayMaxLines = 120, | |
| 5119 | DisplayWidth = 0 | |
| 5120 | }} | |
| 5121 | function GuiTextOutput:Init(data) | |
| 5122 | GuiScrollFrame.Init(self, data) | |
| 5123 | setmetatable(data, GuiTextOutput.__default) | |
| 5124 | self.displayMaxLines = data.DisplayMaxLines | |
| 5125 | self.displayWidth = data.DisplayWidth | |
| 5126 | self.displayItems = {}
| |
| 5127 | self:SetBackgroundTransparency(0) | |
| 5128 | self:SetColor(Color3.new(1, 1, 1)) | |
| 5129 | self.m_scroll_pane.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5) | |
| 5130 | end | |
| 5131 | function GuiTextOutput:IsA(className) | |
| 5132 | return className == "GuiTextOutput" or GuiScrollFrame.IsA(self, className) | |
| 5133 | end | |
| 5134 | function GuiTextOutput:Print(...) | |
| 5135 | self:PrintFormat(nil, ...) | |
| 5136 | end | |
| 5137 | function GuiTextOutput:PrintFormat(options, ...) | |
| 5138 | local buffer = {}
| |
| 5139 | local args = {...}
| |
| 5140 | local first = true | |
| 5141 | for i = 1, select("#", ...) do
| |
| 5142 | buffer[i] = tostring(args[i]) | |
| 5143 | end | |
| 5144 | message = Utility.BlockRobloxFilter(table.concat(buffer, "\t")) | |
| 5145 | local properties = {
| |
| 5146 | BackgroundTransparency = 1, | |
| 5147 | Font = "ArialBold", | |
| 5148 | FontSize = "Size12", | |
| 5149 | Position = UDim2.new(0, 4, 0, self.m_content_height), | |
| 5150 | Text = message, | |
| 5151 | TextColor3 = Color3.new(1, 1, 1), | |
| 5152 | TextWrapped = true, | |
| 5153 | TextXAlignment = "Left", | |
| 5154 | TextYAlignment = "Bottom", | |
| 5155 | Parent = self:GetContentInstance() | |
| 5156 | } | |
| 5157 | if options then | |
| 5158 | for key, value in pairs(options) do | |
| 5159 | properties[key] = value | |
| 5160 | end | |
| 5161 | end | |
| 5162 | local textBounds = GuiService:GetTextBounds(message, properties.Font, properties.FontSize, properties.TextXAlignment, properties.TextYAlignment, | |
| 5163 | ||
| 5164 | self.displayWidth - 20) | |
| 5165 | local textHeight = textBounds.Y | |
| 5166 | properties.Size = UDim2.new(0, self.displayWidth - 8, 0, textBounds.Y) | |
| 5167 | local textLabel = RBXInstance.new "TextLabel" (properties) | |
| 5168 | self.displayItems[#self.displayItems + 1] = textLabel | |
| 5169 | local maxLines = self.displayMaxLines | |
| 5170 | local maxHeight = maxLines * 12 | |
| 5171 | local newHeight = self.m_content_height + textHeight | |
| 5172 | if newHeight > maxHeight then | |
| 5173 | local offset = 0 | |
| 5174 | local newList = {}
| |
| 5175 | local oldList = self.displayItems | |
| 5176 | for index, child in ipairs(oldList) do | |
| 5177 | local childOffset = child.Size.Y.Offset | |
| 5178 | if newHeight > maxHeight then | |
| 5179 | offset = offset + childOffset | |
| 5180 | newHeight = newHeight - childOffset | |
| 5181 | child:Destroy() | |
| 5182 | else | |
| 5183 | child.Position = child.Position - UDim2.new(0, 0, 0, offset) | |
| 5184 | newList[#newList + 1] = child | |
| 5185 | end | |
| 5186 | end | |
| 5187 | self.displayItems = newList | |
| 5188 | end | |
| 5189 | self:SetContentHeight(newHeight) | |
| 5190 | end | |
| 5191 | GuiChatLog = setmetatable({}, GuiScrollFrame)
| |
| 5192 | GuiChatLog.__index = GuiChatLog | |
| 5193 | GuiChatLog.__default = {__index = {
| |
| 5194 | DisplayMaxLines = 200, | |
| 5195 | DisplayWidth = 0, | |
| 5196 | }} | |
| 5197 | function GuiChatLog:Chat(speaker, message) | |
| 5198 | local speaker_color = AdvancedGUI.GenerateChatColor(speaker) | |
| 5199 | speaker = Utility.BlockRobloxFilter(speaker) | |
| 5200 | message = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" .. Utility.BlockRobloxFilter(message) | |
| 5201 | local timestamp = Utility.GetTimestamp() | |
| 5202 | local textBounds = GuiService:GetTextBounds(message, "ArialBold", "Size12", "Left", "Bottom", self.displayWidth - 8) | |
| 5203 | local textHeight = math.max(math.min(textBounds.Y, 36), 12) | |
| 5204 | local message_frame = RBXInstance.new "Frame" {
| |
| 5205 | BackgroundTransparency = 1, | |
| 5206 | Position = UDim2.new(0, 0, 0, self.m_content_height), | |
| 5207 | Size = UDim2.new(0, self.displayWidth, 0, textHeight), | |
| 5208 | Parent = self:GetContentInstance() | |
| 5209 | } | |
| 5210 | local timestamp_label = RBXInstance.new "TextLabel" {
| |
| 5211 | BackgroundTransparency = 1, | |
| 5212 | Font = "ArialBold", | |
| 5213 | FontSize = "Size12", | |
| 5214 | Position = UDim2.new(0, 4, 0, 0), | |
| 5215 | Size = UDim2.new(1, -8, 0, 12), | |
| 5216 | Text = timestamp, | |
| 5217 | TextColor3 = Color3.new(0.75, 0.75, 0.75), | |
| 5218 | TextStrokeTransparency = 0.6, | |
| 5219 | TextWrapped = true, | |
| 5220 | TextXAlignment = "Left", | |
| 5221 | Parent = message_frame | |
| 5222 | } | |
| 5223 | local speaker_label = RBXInstance.new "TextLabel" {
| |
| 5224 | BackgroundTransparency = 1, | |
| 5225 | Font = "ArialBold", | |
| 5226 | FontSize = "Size12", | |
| 5227 | Position = UDim2.new(0, 64, 0, 0), | |
| 5228 | Size = UDim2.new(0, 100, 0, 12), | |
| 5229 | Text = speaker, | |
| 5230 | TextColor3 = speaker_color, | |
| 5231 | TextStrokeTransparency = 0.6, | |
| 5232 | Parent = message_frame | |
| 5233 | } | |
| 5234 | local message_label = RBXInstance.new "TextLabel" {
| |
| 5235 | BackgroundTransparency = 1, | |
| 5236 | Font = "ArialBold", | |
| 5237 | FontSize = "Size12", | |
| 5238 | Position = UDim2.new(0, 4, 0, 0), | |
| 5239 | Size = UDim2.new(1, -8, 1, 0), | |
| 5240 | Text = message, | |
| 5241 | TextColor3 = Color3.new(1, 1, 1), | |
| 5242 | TextStrokeTransparency = 0.6, | |
| 5243 | TextXAlignment = "Left", | |
| 5244 | TextYAlignment = "Bottom", | |
| 5245 | TextWrapped = true, | |
| 5246 | Parent = message_frame | |
| 5247 | } | |
| 5248 | self.displayItems[#self.displayItems + 1] = message_frame | |
| 5249 | local maxLines = self.displayMaxLines | |
| 5250 | local maxHeight = maxLines * 12 | |
| 5251 | local newHeight = self.m_content_height + textHeight | |
| 5252 | if newHeight > maxHeight then | |
| 5253 | local offset = 0 | |
| 5254 | local newList = {}
| |
| 5255 | local oldList = self.displayItems | |
| 5256 | for index, child in ipairs(oldList) do | |
| 5257 | local childOffset = child.Size.Y.Offset | |
| 5258 | if newHeight > maxHeight then | |
| 5259 | offset = offset + childOffset | |
| 5260 | newHeight = newHeight - childOffset | |
| 5261 | child:Destroy() | |
| 5262 | else | |
| 5263 | child.Position = child.Position - UDim2.new(0, 0, 0, offset) | |
| 5264 | newList[#newList + 1] = child | |
| 5265 | end | |
| 5266 | end | |
| 5267 | self.displayItems = newList | |
| 5268 | end | |
| 5269 | self:SetContentHeight(newHeight) | |
| 5270 | end | |
| 5271 | function GuiChatLog:Init(data) | |
| 5272 | GuiScrollFrame.Init(self, data) | |
| 5273 | setmetatable(data, GuiChatLog.__default) | |
| 5274 | self.displayMaxLines = data.DisplayMaxLines | |
| 5275 | self.displayWidth = data.DisplayWidth | |
| 5276 | self.displayItems = {}
| |
| 5277 | end | |
| 5278 | function GuiChatLog:IsA(className) | |
| 5279 | return className == "GuiChatLog" or GuiScrollFrame.IsA(self, className) | |
| 5280 | end | |
| 5281 | GuiSeperator = setmetatable({}, GuiObject)
| |
| 5282 | GuiSeperator.__index = GuiSeperator | |
| 5283 | GuiSeperator.__default = {__index = {
| |
| 5284 | Active = false, | |
| 5285 | Position = UDim2.new(0, 0, 0, 0), | |
| 5286 | Size = UDim2.new(1, 0, 0, 16), | |
| 5287 | Visible = true | |
| 5288 | }} | |
| 5289 | function GuiSeperator:Init(data) | |
| 5290 | GuiObject.Init(self) | |
| 5291 | setmetatable(data, GuiSeperator.__default) | |
| 5292 | local base_frame = RBXInstance.new "Frame" {
| |
| 5293 | BackgroundTransparency = 1, | |
| 5294 | RBXInstance.new "Frame" {
| |
| 5295 | BackgroundColor3 = Color3.new(1, 1, 1), | |
| 5296 | BackgroundTransparency = 0.25, | |
| 5297 | BorderSizePixel = 0, | |
| 5298 | Position = UDim2.new(0.5, -13, 0.5, -1), | |
| 5299 | Size = UDim2.new(0, 3, 0, 3), | |
| 5300 | RBXInstance.new "Frame" {
| |
| 5301 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 5302 | BackgroundTransparency = 0.75, | |
| 5303 | BorderSizePixel = 0, | |
| 5304 | Position = UDim2.new(0, -1, 0, -1), | |
| 5305 | Size = UDim2.new(0, 5, 0, 5) | |
| 5306 | } | |
| 5307 | }, | |
| 5308 | RBXInstance.new "Frame" {
| |
| 5309 | BackgroundColor3 = Color3.new(1, 1, 1), | |
| 5310 | BackgroundTransparency = 0.25, | |
| 5311 | BorderSizePixel = 0, | |
| 5312 | Position = UDim2.new(0.5, -1, 0.5, -1), | |
| 5313 | Size = UDim2.new(0, 3, 0, 3), | |
| 5314 | RBXInstance.new "Frame" {
| |
| 5315 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 5316 | BackgroundTransparency = 0.75, | |
| 5317 | BorderSizePixel = 0, | |
| 5318 | Position = UDim2.new(0, -1, 0, -1), | |
| 5319 | Size = UDim2.new(0, 5, 0, 5) | |
| 5320 | } | |
| 5321 | }, | |
| 5322 | RBXInstance.new "Frame" {
| |
| 5323 | BackgroundColor3 = Color3.new(1, 1, 1), | |
| 5324 | BackgroundTransparency = 0.25, | |
| 5325 | BorderSizePixel = 0, | |
| 5326 | Position = UDim2.new(0.5, 11, 0.5, -1), | |
| 5327 | Size = UDim2.new(0, 3, 0, 3), | |
| 5328 | RBXInstance.new "Frame" {
| |
| 5329 | BackgroundColor3 = Color3.new(0, 0, 0), | |
| 5330 | BackgroundTransparency = 0.75, | |
| 5331 | BorderSizePixel = 0, | |
| 5332 | Position = UDim2.new(0, -1, 0, -1), | |
| 5333 | Size = UDim2.new(0, 5, 0, 5) | |
| 5334 | } | |
| 5335 | } | |
| 5336 | } | |
| 5337 | self.m_base_instance = base_frame | |
| 5338 | self:SetActive(data.Active) | |
| 5339 | self:SetPosition(data.Position) | |
| 5340 | self:SetSize(data.Size) | |
| 5341 | self:SetVisible(data.Visible) | |
| 5342 | self:SetParent(data.Parent) | |
| 5343 | end | |
| 5344 | function GuiSeperator:IsA(className) | |
| 5345 | return className == "GuiSeperator" or GuiObject.IsA(self, className) | |
| 5346 | end | |
| 5347 | local startMenu = GuiFrame:new {
| |
| 5348 | BorderTransparency = 0.5, | |
| 5349 | Position = UDim2.new(0, -4, 0, -4), | |
| 5350 | Size = UDim2.new(0, 68, 1, 8), | |
| 5351 | Parent = GuiService | |
| 5352 | } | |
| 5353 | GuiSeperator:new {
| |
| 5354 | Position = UDim2.new(0, 0, 0, 5), | |
| 5355 | Parent = startMenu | |
| 5356 | } | |
| 5357 | GuiSeperator:new {
| |
| 5358 | Position = UDim2.new(0, 0, 1, -85), | |
| 5359 | Parent = startMenu | |
| 5360 | } | |
| 5361 | local networkButton = GuiTextButton:new {
| |
| 5362 | BackgroundTransparency = 0.9, | |
| 5363 | Mnemonic = "L", | |
| 5364 | Position = UDim2.new(0, 4, 1, -647), | |
| 5365 | Text = "Network", | |
| 5366 | Parent = startMenu | |
| 5367 | } | |
| 5368 | local chatLogButton = GuiTextButton:new {
| |
| 5369 | BackgroundTransparency = 0.9, | |
| 5370 | Mnemonic = "K", | |
| 5371 | Position = UDim2.new(0, 4, 1, -475), | |
| 5372 | Text = "Chat log", | |
| 5373 | Parent = startMenu | |
| 5374 | } | |
| 5375 | local outputButton = GuiTextButton:new {
| |
| 5376 | BackgroundTransparency = 0.9, | |
| 5377 | Mnemonic = "P", | |
| 5378 | Position = UDim2.new(0, 4, 1, -283), | |
| 5379 | Text = "Output", | |
| 5380 | Parent = startMenu | |
| 5381 | } | |
| 5382 | local toolsButton = GuiTextButton:new {
| |
| 5383 | BackgroundTransparency = 0.9, | |
| 5384 | Mnemonic = "O", | |
| 5385 | Position = UDim2.new(0, 4, 1, -137), | |
| 5386 | Text = "Tools", | |
| 5387 | Parent = startMenu | |
| 5388 | } | |
| 5389 | local networkFrame = GuiNetworkList:new {
| |
| 5390 | Position = UDim2.new(0, 66, 1, -647), | |
| 5391 | Size = UDim2.new(0, 0, 0, 168), | |
| 5392 | Visible = false, | |
| 5393 | Parent = GuiService | |
| 5394 | } | |
| 5395 | local chatLogFrame = GuiChatLog:new {
| |
| 5396 | DisplayWidth = 332, | |
| 5397 | Position = UDim2.new(0, 66, 1, -475), | |
| 5398 | Size = UDim2.new(0, 0, 0, 188), | |
| 5399 | Visible = false, | |
| 5400 | Parent = GuiService | |
| 5401 | } | |
| 5402 | local outputFrame = GuiTextOutput:new {
| |
| 5403 | DisplayWidth = 332, | |
| 5404 | Position = UDim2.new(0, 66, 1, -283), | |
| 5405 | Size = UDim2.new(0, 0, 0, 140), | |
| 5406 | Visible = false, | |
| 5407 | Parent = GuiService | |
| 5408 | } | |
| 5409 | local toolsFrame = GuiFrame:new {
| |
| 5410 | Position = UDim2.new(0, 66, 1, -137), | |
| 5411 | Size = UDim2.new(0, 0, 0, 52), | |
| 5412 | Visible = false, | |
| 5413 | Parent = GuiService | |
| 5414 | } | |
| 5415 | local toggleCharacterButton = GuiTextButton:new {
| |
| 5416 | BackgroundTransparency = 0.9, | |
| 5417 | Position = UDim2.new(0, 1, 0, 1), | |
| 5418 | Size = UDim2.new(0, 108, 0, 20), | |
| 5419 | Text = "Enable character", | |
| 5420 | Parent = toolsFrame | |
| 5421 | } | |
| 5422 | local resetCharacterButton = GuiTextButton:new {
| |
| 5423 | BackgroundTransparency = 0.9, | |
| 5424 | Position = UDim2.new(0, 1, 0, 23), | |
| 5425 | Size = UDim2.new(0, 108, 0, 20), | |
| 5426 | Text = "Reset character", | |
| 5427 | Parent = toosFrame | |
| 5428 | } | |
| 5429 | local clearWorkspaceButton = GuiTextButton:new {
| |
| 5430 | BackgroundTransparency = 0.9, | |
| 5431 | Position = UDim2.new(0, 110, 0, 1), | |
| 5432 | Size = UDim2.new(0, 108, 0, 20), | |
| 5433 | Text = "Clear workspace", | |
| 5434 | Parent = toolsFrame | |
| 5435 | } | |
| 5436 | local clearScriptButton = GuiTextButton:new {
| |
| 5437 | BackgroundTransparency = 0.9, | |
| 5438 | Position = UDim2.new(0, 110, 0, 23), | |
| 5439 | Size = UDim2.new(0, 108, 0, 20), | |
| 5440 | Text = "Clear all", | |
| 5441 | Parent = toolsFrame | |
| 5442 | } | |
| 5443 | local fixLightingButton = GuiTextButton:new {
| |
| 5444 | BackgroundTransparency = 0.9, | |
| 5445 | Position = UDim2.new(0, 219, 0, 1), | |
| 5446 | Size = UDim2.new(0, 108, 0, 20), | |
| 5447 | Text = "Fix lighting", | |
| 5448 | Parent = toolsFrame | |
| 5449 | } | |
| 5450 | local reloadCommandsButton = GuiTextButton:new {
| |
| 5451 | BackgroundTransparency = 0.9, | |
| 5452 | Position = UDim2.new(0, 219, 0, 23), | |
| 5453 | Size = UDim2.new(0, 108, 0, 20), | |
| 5454 | Text = "Reload commands", | |
| 5455 | Parent = toolsFrame | |
| 5456 | } | |
| 5457 | toggleCharacterButton.Activated:connect(function() | |
| 5458 | local enabled = not PlayerControl.IsEnabled() | |
| 5459 | if enabled then | |
| 5460 | toggleCharacterButton:SetText("Disable character")
| |
| 5461 | else | |
| 5462 | toggleCharacterButton:SetText("Enable character")
| |
| 5463 | end | |
| 5464 | PlayerControl.SetEnabled(enabled) | |
| 5465 | end) | |
| 5466 | resetCharacterButton.Activated:connect(function() | |
| 5467 | PlayerControl.ResetCharacter() | |
| 5468 | end) | |
| 5469 | clearWorkspaceButton.Activated:connect(function() | |
| 5470 | Utility.CleanWorkspace() | |
| 5471 | end) | |
| 5472 | clearScriptButton.Activated:connect(function() | |
| 5473 | Utility.CleanWorkspaceAndScripts() | |
| 5474 | end) | |
| 5475 | fixLightingButton.Activated:connect(function() | |
| 5476 | Utility.CleanLighting() | |
| 5477 | end) | |
| 5478 | reloadCommandsButton.Activated:connect(function() | |
| 5479 | UserInterface.FixChattedConnection() | |
| 5480 | end) | |
| 5481 | local networkFrameActive = false | |
| 5482 | local networkFrameTweening = false | |
| 5483 | networkButton.Activated:connect(function() | |
| 5484 | if not networkFrameTweening then | |
| 5485 | networkFrameActive = not networkFrameActive | |
| 5486 | networkFrameTweening = true | |
| 5487 | if networkFrameActive then | |
| 5488 | networkFrame:SetVisible(true) | |
| 5489 | networkFrame.m_base_instance:TweenSize(UDim2.new(0, 276, 0, 168), nil, nil, 0.5) | |
| 5490 | wait(0.5) | |
| 5491 | else | |
| 5492 | networkFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 168), nil, nil, 0.5) | |
| 5493 | wait(0.5) | |
| 5494 | networkFrame:SetVisible(false) | |
| 5495 | end | |
| 5496 | networkFrameTweening = false | |
| 5497 | end | |
| 5498 | end) | |
| 5499 | local chatLogFrameActive = false | |
| 5500 | local chatLogFrameTweening = false | |
| 5501 | chatLogButton.Activated:connect(function() | |
| 5502 | if not chatLogFrameTweening then | |
| 5503 | chatLogFrameActive = not chatLogFrameActive | |
| 5504 | chatLogFrameTweening = true | |
| 5505 | if chatLogFrameActive then | |
| 5506 | chatLogFrame:SetVisible(true) | |
| 5507 | chatLogFrame.m_base_instance:TweenSize(UDim2.new(0, 360, 0, 188), nil, nil, 0.5) | |
| 5508 | wait(0.5) | |
| 5509 | else | |
| 5510 | chatLogFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 188), nil, nil, 0.5) | |
| 5511 | wait(0.5) | |
| 5512 | chatLogFrame:SetVisible(false) | |
| 5513 | end | |
| 5514 | chatLogFrameTweening = false | |
| 5515 | end | |
| 5516 | end) | |
| 5517 | local outputFrameActive = false | |
| 5518 | local outputFrameTweening = false | |
| 5519 | outputButton.Activated:connect(function() | |
| 5520 | if not outputFrameTweening then | |
| 5521 | outputFrameActive = not outputFrameActive | |
| 5522 | outputFrameTweening = true | |
| 5523 | if outputFrameActive then | |
| 5524 | outputFrame:SetVisible(true) | |
| 5525 | outputFrame.m_base_instance:TweenSize(UDim2.new(0, 360, 0, 140), nil, nil, 0.5) | |
| 5526 | wait(0.5) | |
| 5527 | else | |
| 5528 | outputFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 140), nil, nil, 0.5) | |
| 5529 | wait(0.5) | |
| 5530 | outputFrame:SetVisible(false) | |
| 5531 | end | |
| 5532 | outputFrameTweening = false | |
| 5533 | end | |
| 5534 | end) | |
| 5535 | local toolsFrameActive = false | |
| 5536 | local toolsFrameTweening = false | |
| 5537 | toolsButton.Activated:connect(function() | |
| 5538 | if not toolsFrameTweening then | |
| 5539 | toolsFrameActive = not toolsFrameActive | |
| 5540 | toolsFrameTweening = true | |
| 5541 | if toolsFrameActive then | |
| 5542 | toolsFrame:SetVisible(true) | |
| 5543 | toolsFrame.m_base_instance:TweenSize(UDim2.new(0, 336, 0, 52), nil, nil, 0.5) | |
| 5544 | wait(0.5) | |
| 5545 | else | |
| 5546 | toolsFrame.m_base_instance:TweenSize(UDim2.new(0, 0, 0, 52), nil, nil, 0.5) | |
| 5547 | wait(0.5) | |
| 5548 | toolsFrame:SetVisible(false) | |
| 5549 | end | |
| 5550 | toolsFrameTweening = false | |
| 5551 | end | |
| 5552 | end) | |
| 5553 | AdvancedGUI.startMenu = startMenu | |
| 5554 | AdvancedGUI.networkFrame = networkFrame | |
| 5555 | AdvancedGUI.outputFrame = outputFrame | |
| 5556 | AdvancedGUI.toolsFrame = toolsFrame | |
| 5557 | AdvancedGUI.chatLogFrame = chatLogFrame | |
| 5558 | AdvancedGUI.toggleCharacterButton = toggleCharacterButton | |
| 5559 | AdvancedGUI.reloadCommandsButton = reloadCommandsButton | |
| 5560 | function AdvancedGUI.Print(...) | |
| 5561 | AdvancedGUI.outputFrame:Print(...) | |
| 5562 | end | |
| 5563 | function AdvancedGUI.PrintFormat(...) | |
| 5564 | AdvancedGUI.outputFrame:PrintFormat(...) | |
| 5565 | end | |
| 5566 | function AdvancedGUI.PrintChatLog(speaker, message) | |
| 5567 | AdvancedGUI.chatLogFrame:Chat(speaker, message) | |
| 5568 | end | |
| 5569 | for _, entry in Logger.NodeIterator, Logger.entries do | |
| 5570 | if entry then | |
| 5571 | local messageType = entry[1] | |
| 5572 | local messageTypeValue | |
| 5573 | if messageType == Logger.MessageType.Error then | |
| 5574 | messageTypeValue = Logger.MessageType.Severe.Value | |
| 5575 | else | |
| 5576 | messageTypeValue = messageType.Value | |
| 5577 | end | |
| 5578 | AdvancedGUI.outputFrame:PrintFormat(Logger.MESSAGE_TYPE_SETTINGS[messageTypeValue], entry[2]) | |
| 5579 | else | |
| 5580 | break | |
| 5581 | end | |
| 5582 | end | |
| 5583 | ||
| 5584 | function GetPlayers(str) | |
| 5585 | local found = {};
| |
| 5586 | if str == "all" then | |
| 5587 | for i,v in pairs(game.Players:children()) do | |
| 5588 | if v:IsA("Player") then table.insert(found,v) end
| |
| 5589 | end | |
| 5590 | else | |
| 5591 | for i,v in pairs(game.Players:children()) do | |
| 5592 | if string.match(v.Name:lower(), str:lower()) and v:IsA("Player") then
| |
| 5593 | table.insert(found,v) | |
| 5594 | end | |
| 5595 | end | |
| 5596 | end | |
| 5597 | return found | |
| 5598 | end | |
| 5599 | ||
| 5600 | function NewCMD(nme, usg, desc,func) | |
| 5601 | table.insert(CMDS, {['Name']=nme, ['Usage']=usg, ['Description']=desc, ['Function']=func})
| |
| 5602 | end | |
| 5603 | ||
| 5604 | NewCMD("Chat Theme", "ctheme", "Changes the chat theme", function(msg) ChatBubble.SetTheme(msg) end)
| |
| 5605 | NewCMD("Clean", "clr", "Clears the game", function() Utility.CleanWorkspaceAndScripts() end)
| |
| 5606 | NewCMD("Fix Lighting", "fixl", "Fixes the lighting",function() Utility.CleanLighting() end)
| |
| 5607 | NewCMD("Dismiss", "d", "Dismisses tabs",function()
| |
| 5608 | Dismiss() | |
| 5609 | ChatBubble.Create("Dismissed Tabs...")
| |
| 5610 | end) | |
| 5611 | ||
| 5612 | NewCMD("Kill", "kill", "Kills the player", function(msg)
| |
| 5613 | local plrs = GetPlayers(msg) | |
| 5614 | for _,plr in next,plrs do | |
| 5615 | ||
| 5616 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2})
| |
| 5617 | plr.Character:BreakJoints() | |
| 5618 | ||
| 5619 | end | |
| 5620 | end) | |
| 5621 | ||
| 5622 | NewCMD("Private Server", "ps", "Makes the server private!",function()
| |
| 5623 | game.Players.PlayerAdded:connect(function(player) | |
| 5624 | player.CharacterAdded:connect(function(h) | |
| 5625 | if player.Name ~= "PointCoded" or "nguyenjimbo" or game.Players.LocalPlayer.Name then | |
| 5626 | wait(0.5) | |
| 5627 | player:Kick() | |
| 5628 | end | |
| 5629 | end) | |
| 5630 | end) | |
| 5631 | ChatBubble.Create("Private Server is Activated")
| |
| 5632 | end) | |
| 5633 | ||
| 5634 | NewCMD("nonPrivate Server", "nps", "Makes the server not private!",function()
| |
| 5635 | Pserver = false | |
| 5636 | ChatBubble.Create("Private Server Is no longer Activated")
| |
| 5637 | end) | |
| 5638 | ||
| 5639 | ||
| 5640 | NewCMD("Remove hidden sb", "rhs", "Removes a player's hidden sb", function(msg)
| |
| 5641 | local plrs = GetPlayers(msg) | |
| 5642 | for _,plr in next,plrs do | |
| 5643 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2})
| |
| 5644 | plr.PlayerGui:ClearAllChildren() | |
| 5645 | end | |
| 5646 | end) | |
| 5647 | ||
| 5648 | NewCMD("Day", "day", "Makes the time day", function()
| |
| 5649 | game.Lighting.TimeOfDay = "12:00:00" | |
| 5650 | ChatBubble.Create("It is now day")
| |
| 5651 | end) | |
| 5652 | ||
| 5653 | NewCMD("Night", "night", "Makes the time night", function()
| |
| 5654 | game.Lighting.TimeOfDay = "00:00:00" | |
| 5655 | ChatBubble.Create("It is now night")
| |
| 5656 | end) | |
| 5657 | ||
| 5658 | NewCMD("Midnight", "midnight", "Makes the time midnight", function()
| |
| 5659 | game.Lighting.TimeOfDay = "06:00:00" | |
| 5660 | ChatBubble.Create("It is now midnight")
| |
| 5661 | end) | |
| 5662 | ||
| 5663 | ||
| 5664 | NewCMD("Teleport", "tp", "Teleports you to a player",function(msg)
| |
| 5665 | local plrs = GetPlayers(msg) | |
| 5666 | for _,plr in next,plrs do | |
| 5667 | local Nam = plr.Name | |
| 5668 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.5})
| |
| 5669 | Player.Character.Torso.CFrame = plr.Character.Torso.CFrame | |
| 5670 | ChatBubble.Create("Teleported you to: "..Nam.."!")
| |
| 5671 | end | |
| 5672 | end) | |
| 5673 | ||
| 5674 | NewCMD("Admin", "adm", "Admins a player",function(msg)
| |
| 5675 | local plrs = GetPlayers(msg) | |
| 5676 | for _,plr in next,plrs do | |
| 5677 | if plr.Character then | |
| 5678 | local shared = script:clone() | |
| 5679 | shared.Disabled = true | |
| 5680 | shared.Parent = plr.Backpack | |
| 5681 | wait(1) | |
| 5682 | shared.Disabled = false | |
| 5683 | end | |
| 5684 | end | |
| 5685 | end) | |
| 5686 | ||
| 5687 | NewCMD("Blast", "blas", "Blasts a player",function(msg)
| |
| 5688 | local plrs = GetPlayers(msg) | |
| 5689 | for _,plr in next,plrs do | |
| 5690 | function HSV(H,S,V) | |
| 5691 | plr.Character.Torso.Anchored = true | |
| 5692 | H = H % 360 | |
| 5693 | local C = V * S | |
| 5694 | local H2 = H/60 | |
| 5695 | local X = C * (1 - math.abs((H2 %2) -1)) | |
| 5696 | local color = Color3.new(0,0,0) | |
| 5697 | if H2 <= 0 then | |
| 5698 | color = Color3.new(C,0,0) | |
| 5699 | elseif 0 <= H2 and H2 <= 1 then | |
| 5700 | color = Color3.new(C,X,0) | |
| 5701 | elseif 1 <= H2 and H2 <= 2 then | |
| 5702 | color = Color3.new(X,C,0) | |
| 5703 | elseif 2 <= H2 and H2 <= 3 then | |
| 5704 | color = Color3.new(0,C,X) | |
| 5705 | elseif 3 <= H2 and H2 <= 4 then | |
| 5706 | color = Color3.new(0,X,C) | |
| 5707 | elseif 4 <= H2 and H2 <= 5 then | |
| 5708 | color = Color3.new(X,0,C) | |
| 5709 | elseif 5 <= H2 and H2 <= 6 then | |
| 5710 | color = Color3.new(C,0,X) | |
| 5711 | end | |
| 5712 | local m = V - C | |
| 5713 | return Color3.new(color.r + m, color.g + m, color.b + m) | |
| 5714 | end | |
| 5715 | ||
| 5716 | ||
| 5717 | if plr.Character.Torso then | |
| 5718 | plr.Character.Torso.CFrame = plr.Character.Torso.CFrame * CFrame.new(0, 350, 0) | |
| 5719 | wait(2) | |
| 5720 | local p = Instance.new("Part", workspace)
| |
| 5721 | p.FormFactor = "Custom" | |
| 5722 | p.Anchored = true | |
| 5723 | p.Locked = true | |
| 5724 | p.CFrame = CFrame.new(plr.Character.Torso.CFrame.x,plr.Character.Torso.CFrame.y, plr.Character.Torso.CFrame.z) * CFrame.Angles(math.pi/2, 0, 0) | |
| 5725 | p.Size = Vector3.new(0.2, 0.2, 0.2) | |
| 5726 | p.CanCollide = false | |
| 5727 | local msh = Instance.new("SpecialMesh", p)
| |
| 5728 | msh.MeshId = "http://www.roblox.com/asset/?id=3270017" | |
| 5729 | msh.TextureId = "http://www.roblox.com/asset/?id=48358980" | |
| 5730 | ||
| 5731 | local hue = 0 | |
| 5732 | for _ = 0, 5000 do | |
| 5733 | hue = ((hue+0.5)%360) | |
| 5734 | msh.Scale = msh.Scale + Vector3.new(2, 2, 0) | |
| 5735 | p.Transparency = p.Transparency + 0.005 | |
| 5736 | local colur = HSV(hue,1,1) | |
| 5737 | msh.VertexColor = Vector3.new(colur.r,colur.g,colur.b) | |
| 5738 | wait() | |
| 5739 | plr.Character.Torso.Anchored = false | |
| 5740 | end | |
| 5741 | end | |
| 5742 | end | |
| 5743 | end) | |
| 5744 | ||
| 5745 | NewCMD("Fire", "fi", "Sets a player on fire",function(msg)
| |
| 5746 | local plrs = GetPlayers(msg) | |
| 5747 | for _,plr in next,plrs do | |
| 5748 | local Nam = plr.Name | |
| 5749 | local F = Instance.new("Fire")
| |
| 5750 | F.Parent = plr.Character.Torso | |
| 5751 | ChatBubble.Create("Given Fire to: "..plr.Name"!")
| |
| 5752 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Deep orange"), float_duration = 0.2})
| |
| 5753 | end | |
| 5754 | end) | |
| 5755 | ||
| 5756 | NewCMD("Sparkles", "spa", "Gives a player sparkles",function(msg)
| |
| 5757 | local plrs = GetPlayers(msg) | |
| 5758 | for _,plr in next,plrs do | |
| 5759 | local F = Instance.new("Sparkles")
| |
| 5760 | F.Parent = plr.Character.Torso | |
| 5761 | ChatBubble.Create("Given Sparkles")
| |
| 5762 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2})
| |
| 5763 | end | |
| 5764 | end) | |
| 5765 | NewCMD("Rpe", "rpe", "Lets you rpe a player",function(msg)
| |
| 5766 | local plrs = GetPlayers(msg) | |
| 5767 | for _,plr in next,plrs do | |
| 5768 | n1 = game.Players.LocalPlayer.Name | |
| 5769 | n2 = plr.Name | |
| 5770 | t1 = game.Players[n1].Character.Torso | |
| 5771 | t2 = game.Players[n2].Character.Torso | |
| 5772 | t2.Parent.Humanoid.PlatformStand = true | |
| 5773 | t1["Left Shoulder"]:Remove() | |
| 5774 | ls1 = Instance.new("Weld")
| |
| 5775 | ls1.Parent = t1 | |
| 5776 | ls1.Part0 = t1 | |
| 5777 | ls1.Part1 = t1.Parent["Left Arm"] | |
| 5778 | ls1.C0 = CFrame.new(-1.5,0,0) | |
| 5779 | ls1.Name = "Left Shoulder" | |
| 5780 | t1["Right Shoulder"]:Remove() | |
| 5781 | rs1 = Instance.new("Weld")
| |
| 5782 | rs1.Parent = t1 | |
| 5783 | rs1.Part0 = t1 | |
| 5784 | rs1.Part1 = t1.Parent["Right Arm"] | |
| 5785 | rs1.C0 = CFrame.new(1.5,0,0) | |
| 5786 | rs1.Name = "Right Shoulder" | |
| 5787 | --[[ t1["Left Hip"]:Remove() | |
| 5788 | lh1 = Instance.new("Weld")
| |
| 5789 | lh1.Parent = t1 | |
| 5790 | lh1.Part0 = t1 | |
| 5791 | lh1.Part1 = t1.Parent["Left Leg"] | |
| 5792 | lh1.C0 = CFrame.new(-0.5,-2,0) | |
| 5793 | lh1.Name = "Left Hip" t1["Right Hip"]:Remove() | |
| 5794 | rh1 = Instance.new("Weld") rh1.Parent = t1
| |
| 5795 | rh1.Part0 = t1 | |
| 5796 | rh1.Part1 = t1.Parent["Right Leg"] | |
| 5797 | rh1.C0 = CFrame.new(0.5,-2,0) | |
| 5798 | rh1.Name = "Right Hip"]] | |
| 5799 | t2["Left Shoulder"]:Remove() | |
| 5800 | ls2 = Instance.new("Weld")
| |
| 5801 | ls2.Parent = t2 | |
| 5802 | ls2.Part0 = t2 | |
| 5803 | ls2.Part1 = t2.Parent["Left Arm"] | |
| 5804 | ls2.C0 = CFrame.new(-1.5,0,0) | |
| 5805 | ls2.Name = "Left Shoulder" | |
| 5806 | t2["Right Shoulder"]:Remove() | |
| 5807 | rs2 = Instance.new("Weld")
| |
| 5808 | rs2.Parent = t2 | |
| 5809 | rs2.Part0 = t2 | |
| 5810 | rs2.Part1 = t2.Parent["Right Arm"] | |
| 5811 | rs2.C0 = CFrame.new(1.5,0,0) | |
| 5812 | rs2.Name = "Right Shoulder" | |
| 5813 | t2["Left Hip"]:Remove() | |
| 5814 | lh2 = Instance.new("Weld")
| |
| 5815 | lh2.Parent = t2 | |
| 5816 | lh2.Part0 = t2 | |
| 5817 | lh2.Part1 = t2.Parent["Left Leg"] | |
| 5818 | lh2.C0 = CFrame.new(-0.5,-2,0) | |
| 5819 | lh2.Name = "Left Hip" | |
| 5820 | t2["Right Hip"]:Remove() | |
| 5821 | rh2 = Instance.new("Weld")
| |
| 5822 | rh2.Parent = t2 | |
| 5823 | rh2.Part0 = t2 | |
| 5824 | rh2.Part1 = t2.Parent["Right Leg"] | |
| 5825 | rh2.C0 = CFrame.new(0.5,-2,0) | |
| 5826 | rh2.Name = "Right Hip" | |
| 5827 | local d = Instance.new("Part")
| |
| 5828 | d.TopSurface = 0 | |
| 5829 | d.BottomSurface = 0 | |
| 5830 | d.CanCollide = false | |
| 5831 | d.BrickColor = BrickColor.new("Medium stone grey")
| |
| 5832 | d.Shape = "Ball" d.Parent = t1 | |
| 5833 | d.Size = Vector3.new(1,1,1) | |
| 5834 | local dm = Instance.new("SpecialMesh")
| |
| 5835 | dm.MeshType = "Sphere" | |
| 5836 | dm.Parent = d | |
| 5837 | dm.Scale = Vector3.new(0.4,0.4,0.4) | |
| 5838 | fWeld("weld",t1,t1,d,true,-0.2,-1.3,-0.6,0,0,0)
| |
| 5839 | d2 = d:Clone() | |
| 5840 | d2.Parent = t1 | |
| 5841 | fWeld("weld",t1,t1,d2,true,0.2,-1.3,-0.6,0,0,0)
| |
| 5842 | local c = Instance.new("Part")
| |
| 5843 | c.TopSurface = 0 c.BottomSurface = 0 | |
| 5844 | c.CanCollide = false | |
| 5845 | c.BrickColor = BrickColor.new("Pastel brown")
| |
| 5846 | c.Parent = t1 | |
| 5847 | c.formFactor = "Custom" | |
| 5848 | c.Size = Vector3.new(0.4,1.3,0.4) | |
| 5849 | cm = Instance.new("CylinderMesh")
| |
| 5850 | cm.Parent = c | |
| 5851 | a = fWeld("weld",t1,t1,c,true,0,-1,-0.52+(-c.Size.y/2),math.rad(-80),0,0)
| |
| 5852 | c2 = d:Clone() | |
| 5853 | c2.BrickColor = BrickColor.new("Medium stone grey")
| |
| 5854 | c2.Mesh.Scale = Vector3.new(0.4,0.62,0.4) | |
| 5855 | c2.Parent = t1 | |
| 5856 | fWeld("weld",c,c,c2,true,0,0+(c.Size.y/2),0,math.rad(-10),0,0)
| |
| 5857 | local bl = Instance.new("Part")
| |
| 5858 | bl.TopSurface = 0 | |
| 5859 | bl.BottomSurface = 0 | |
| 5860 | bl.CanCollide = false | |
| 5861 | bl.BrickColor = BrickColor.new("Pastel brown")
| |
| 5862 | bl.Shape = "Ball" | |
| 5863 | bl.Parent = t2 | |
| 5864 | bl.Size = Vector3.new(1,1,1) | |
| 5865 | local dm = Instance.new("SpecialMesh")
| |
| 5866 | dm.MeshType = "Sphere" | |
| 5867 | dm.Parent = bl | |
| 5868 | dm.Scale = Vector3.new(1.2,1.2,1.2) | |
| 5869 | fWeld("weld",t2,t2,bl,true,-0.5,0.5,-0.6,0,0,0)
| |
| 5870 | local br = Instance.new("Part")
| |
| 5871 | br.TopSurface = 0 | |
| 5872 | br.BottomSurface = 0 | |
| 5873 | br.CanCollide = false | |
| 5874 | br.BrickColor = BrickColor.new("Pastel brown")
| |
| 5875 | br.Shape = "Ball" | |
| 5876 | br.Parent = t2 | |
| 5877 | br.Size = Vector3.new(1,1,1) | |
| 5878 | local dm = Instance.new("SpecialMesh")
| |
| 5879 | dm.MeshType = "Sphere" | |
| 5880 | dm.Parent = br | |
| 5881 | dm.Scale = Vector3.new(1.2,1.2,1.2) | |
| 5882 | fWeld("weld",t2,t2,br,true,0.5,0.5,-0.6,0,0,0)
| |
| 5883 | local bln = Instance.new("Part")
| |
| 5884 | bln.TopSurface = 0 | |
| 5885 | bln.BottomSurface = 0 | |
| 5886 | bln.CanCollide = false | |
| 5887 | bln.Shape = "Ball" | |
| 5888 | bln.Parent = t2 | |
| 5889 | bln.Size = Vector3.new(1,1,1) | |
| 5890 | local dm = Instance.new("SpecialMesh")
| |
| 5891 | dm.MeshType = "Sphere" | |
| 5892 | dm.Parent = bln | |
| 5893 | dm.Scale = Vector3.new(0.2,0.2,0.2) | |
| 5894 | fWeld("weld",t2,t2,bln,true,-0.5,0.5,-1.2,0,0,0)
| |
| 5895 | local brn = Instance.new("Part")
| |
| 5896 | brn.TopSurface = 0 | |
| 5897 | brn.BottomSurface = 0 | |
| 5898 | brn.CanCollide = false | |
| 5899 | brn.Shape = "Ball" | |
| 5900 | brn.Parent = t2 | |
| 5901 | brn.Size = Vector3.new(1,1,1) | |
| 5902 | local dm = Instance.new("SpecialMesh")
| |
| 5903 | dm.MeshType = "Sphere" | |
| 5904 | dm.Parent = brn | |
| 5905 | dm.Scale = Vector3.new(0.2,0.2,0.2) | |
| 5906 | fWeld("weld",t2,t2,brn,true,0.5,0.5,-1.2,0,0,0)
| |
| 5907 | lh2.C1 = CFrame.new(0,-1.5,-0.5) *CFrame.Angles(0.9,-0.4,0) | |
| 5908 | rh2.C1 = CFrame.new(0,-1.5,-0.5) *CFrame.Angles(0.9,0.4,0) | |
| 5909 | ls2.C1 = CFrame.new(-0.5,-1.3,-0.5) *CFrame.Angles(0.9,-0.4,0) | |
| 5910 | rs2.C1 = CFrame.new(0.5,-1.3,-0.5) *CFrame.Angles(0.9,0.4,0) | |
| 5911 | ls1.C1 = CFrame.new(-0.5,0.7,0) *CFrame.Angles(-0.9,-0.4,0) | |
| 5912 | rs1.C1 = CFrame.new(0.5,0.7,0) *CFrame.Angles(-0.9,0.4,0) | |
| 5913 | if t1:findFirstChild("weldx") ~= nil then
| |
| 5914 | t1.weldx:Remove() end | |
| 5915 | we = fWeld("weldx",t1,t1,t2,true,0,-0.9,-1.3,math.rad(-90),0,0)
| |
| 5916 | n = t2.Neck | |
| 5917 | n.C0 = CFrame.new(0,1.5,0) *CFrame.Angles(math.rad(-210),math.rad(180),0) | |
| 5918 | while true do wait() for i=1,6 do we.C1 = we.C1 * CFrame.new(0,-0.3,0) wait() end | |
| 5919 | for i=1,6 do we.C1 = we.C1 * CFrame.new(0,0.3,0) wait() end end | |
| 5920 | end | |
| 5921 | end | |
| 5922 | ) | |
| 5923 | ||
| 5924 | NewCMD("Box", "box", "Gives the player an outline",function(msg)
| |
| 5925 | local plrs = GetPlayers(msg) | |
| 5926 | for _,plr in next,plrs do | |
| 5927 | if plr and plr.Character then | |
| 5928 | if plr.Character:findFirstChild("Torso") then
| |
| 5929 | for _,base in pairs(plr.Character:children()) do | |
| 5930 | if base:IsA("BasePart") then
| |
| 5931 | local box = Instance.new("SelectionBox", base)
| |
| 5932 | box.Adornee = base | |
| 5933 | box.Color = BrickColor.new("Really black")
| |
| 5934 | end | |
| 5935 | end | |
| 5936 | end | |
| 5937 | end | |
| 5938 | end | |
| 5939 | ||
| 5940 | end) | |
| 5941 | ||
| 5942 | NewCMD("Remove Box", "box", "removes a players outline",function(msg)
| |
| 5943 | local plrs = GetPlayers(msg) | |
| 5944 | for _,plr in next,plrs do | |
| 5945 | if plr and plr.Character then | |
| 5946 | for _,base in pairs(plr.Character:children()) do | |
| 5947 | if base:IsA("BasePart") then
| |
| 5948 | for _,b in pairs(base:children()) do | |
| 5949 | if b:IsA("SelectionBox") then
| |
| 5950 | b:Destroy() | |
| 5951 | end | |
| 5952 | end | |
| 5953 | end | |
| 5954 | end | |
| 5955 | end | |
| 5956 | end | |
| 5957 | ||
| 5958 | end) | |
| 5959 | ||
| 5960 | NewCMD("ClearBackpack", "cback", "Clears a players backpack",function(msg)
| |
| 5961 | local plrs = GetPlayers(msg) | |
| 5962 | for _,plr in next,plrs do | |
| 5963 | plr.Backpack:ClearAllChildren() | |
| 5964 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2})
| |
| 5965 | end | |
| 5966 | end) | |
| 5967 | ||
| 5968 | NewCMD("Btools", "bto", "Gives a player building tools",function(msg)
| |
| 5969 | local plrs = GetPlayers(msg) | |
| 5970 | for _,plr in next,plrs do | |
| 5971 | local x = game:GetService("InsertService"):LoadAsset(73089166) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 5972 | local x = game:GetService("InsertService"):LoadAsset(73089204) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 5973 | local x = game:GetService("InsertService"):LoadAsset(73089190) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 5974 | local x = game:GetService("InsertService"):LoadAsset(58880579) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 5975 | local x = game:GetService("InsertService"):LoadAsset(60791062) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 5976 | local x = game:GetService("InsertService"):LoadAsset(73089239) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 5977 | ChatBubble.Create("Given Btools")
| |
| 5978 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2})
| |
| 5979 | end | |
| 5980 | end) | |
| 5981 | ||
| 5982 | NewCMD("Knife", "kni", "Gives a player a knife",function(msg)
| |
| 5983 | local plrs = GetPlayers(msg) | |
| 5984 | for _,plr in next,plrs do | |
| 5985 | ChatBubble.Create("Given Knife")
| |
| 5986 | local x = game:GetService("InsertService"):LoadAsset(170897263) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 5987 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2})
| |
| 5988 | end | |
| 5989 | end) | |
| 5990 | ||
| 5991 | NewCMD("Darksteel", "drks", "Gives a player the darksteel katana",function(msg)
| |
| 5992 | local plrs = GetPlayers(msg) | |
| 5993 | for _,plr in next,plrs do | |
| 5994 | local x = game:GetService("InsertService"):LoadAsset(86494893) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 5995 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2})
| |
| 5996 | end | |
| 5997 | end) | |
| 5998 | ||
| 5999 | NewCMD("Archer", "arch", "Gives a player ALOT of bows",function(msg)
| |
| 6000 | local plrs = GetPlayers(msg) | |
| 6001 | for _,plr in next,plrs do | |
| 6002 | local x = game:GetService("InsertService"):LoadAsset(92142841) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 6003 | local x = game:GetService("InsertService"):LoadAsset(110892267) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 6004 | local x = game:GetService("InsertService"):LoadAsset(160198008) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 6005 | local x = game:GetService("InsertService"):LoadAsset(204485737) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 6006 | local x = game:GetService("InsertService"):LoadAsset(223785350) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 6007 | local x = game:GetService("InsertService"):LoadAsset(287425246) x.Parent =game.Players.LocalPlayer.Backpack
| |
| 6008 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2})
| |
| 6009 | end | |
| 6010 | end) | |
| 6011 | ||
| 6012 | NewCMD("Swords", "swor", "Gives a player ALOT of swords",function(msg)
| |
| 6013 | local plrs = GetPlayers(msg) | |
| 6014 | for _,plr in next,plrs do | |
| 6015 | local x = game:GetService("InsertService"):LoadAsset(159229806) x.Parent = game.Players.LocalPlayer.Backpack
| |
| 6016 | local x = game:GetService("InsertService"):LoadAsset(101191388) x.Parent = game.Players.LocalPlayer.Backpack
| |
| 6017 | local x = game:GetService("InsertService"):LoadAsset(77443491) x.Parent = game.Players.LocalPlayer.Backpack
| |
| 6018 | local x = game:GetService("InsertService"):LoadAsset(77443461) x.Parent = game.Players.LocalPlayer.Backpack
| |
| 6019 | local x = game:GetService("InsertService"):LoadAsset(108149175) x.Parent = game.Players.LocalPlayer.Backpack
| |
| 6020 | local x = game:GetService("InsertService"):LoadAsset(53623248) x.Parent = game.Players.LocalPlayer.Backpack
| |
| 6021 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Lily white"), float_duration = 0.2})
| |
| 6022 | end | |
| 6023 | end) | |
| 6024 | ||
| 6025 | NewCMD("Fire,Sparkles,ForceField", "fsf", "Gives a player Fire+Sparkles+FF",function(msg)
| |
| 6026 | local plrs = GetPlayers(msg) | |
| 6027 | for _,plr in next,plrs do | |
| 6028 | local F = Instance.new("Sparkles")
| |
| 6029 | F.Parent = plr.Character.Torso | |
| 6030 | local F = Instance.new("Fire")
| |
| 6031 | F.Parent = plr.Character.Torso | |
| 6032 | local F = Instance.new("ForceField")
| |
| 6033 | F.Parent = plr.Character | |
| 6034 | ||
| 6035 | end | |
| 6036 | end) | |
| 6037 | ||
| 6038 | NewCMD("ForceField", "ff", "Gives a player a ForceField",function(msg)
| |
| 6039 | local plrs = GetPlayers(msg) | |
| 6040 | for _,plr in next,plrs do | |
| 6041 | local F = Instance.new("ForceField")
| |
| 6042 | F.Parent = plr.Character | |
| 6043 | ChatBubble.Create("Given FF!")
| |
| 6044 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Teal"), float_duration = 0.2})
| |
| 6045 | end | |
| 6046 | end) | |
| 6047 | ||
| 6048 | NewCMD("RemoveFire", "rfia", "Removes fire from a player",function(msg)
| |
| 6049 | local plrs = GetPlayers(msg) | |
| 6050 | for _,plr in next,plrs do | |
| 6051 | for _,Child in pairs(plr["Character"].Torso:GetChildren()) do | |
| 6052 | if Child:IsA("Fire") then
| |
| 6053 | Child:Destroy() | |
| 6054 | end | |
| 6055 | end | |
| 6056 | end | |
| 6057 | end) | |
| 6058 | ||
| 6059 | NewCMD("Stop Messages", "sm", "Clears all messages in the workspace",function()
| |
| 6060 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
| 6061 | if Child:IsA("Message") then
| |
| 6062 | Child:Destroy() | |
| 6063 | end | |
| 6064 | end | |
| 6065 | end) | |
| 6066 | ||
| 6067 | NewCMD("Always Stop Messages", "asm", "Always Clears all messages in the workspace",function()
| |
| 6068 | asm = true | |
| 6069 | end) | |
| 6070 | ||
| 6071 | NewCMD("Never Stop Messages", "nsm", "never Clears all messages in the workspace",function()
| |
| 6072 | asm = false | |
| 6073 | end) | |
| 6074 | ||
| 6075 | NewCMD("RemoveSparkles", "rsp", "Removes Sparkles From A Player",function(msg)
| |
| 6076 | local plrs = GetPlayers(msg) | |
| 6077 | for _,plr in next,plrs do | |
| 6078 | for _,Child in pairs(plr["Character"].Torso:GetChildren()) do | |
| 6079 | if Child:IsA("Sparkles") then
| |
| 6080 | Child:Destroy() | |
| 6081 | end | |
| 6082 | end | |
| 6083 | end | |
| 6084 | end) | |
| 6085 | ||
| 6086 | NewCMD("RemoveForceField", "rff", "Removes ff from a player",function(msg)
| |
| 6087 | local plrs = GetPlayers(msg) | |
| 6088 | for _,plr in next,plrs do | |
| 6089 | for _,Child in pairs(plr["Character"]:GetChildren()) do | |
| 6090 | if Child:IsA("ForceField") then
| |
| 6091 | Child:Destroy() | |
| 6092 | end | |
| 6093 | end | |
| 6094 | end | |
| 6095 | end) | |
| 6096 | ||
| 6097 | NewCMD("God", "go", "Makes a player god",function(msg)
| |
| 6098 | local plrs = GetPlayers(msg) | |
| 6099 | for _,plr in next,plrs do | |
| 6100 | plr.Character.Humanoid.MaxHealth = math.huge | |
| 6101 | plr.Character.Humanoid.Health = math.huge | |
| 6102 | ChatBubble.Create("Goded Player!")
| |
| 6103 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2})
| |
| 6104 | end | |
| 6105 | end) | |
| 6106 | ||
| 6107 | NewCMD("Remove god", "rgo", "Remove god from a player",function(msg)
| |
| 6108 | local plrs = GetPlayers(msg) | |
| 6109 | for _,plr in next,plrs do | |
| 6110 | plr.Character.Humanoid.MaxHealth = 100 | |
| 6111 | plr.Character.Humanoid.Health = 100 | |
| 6112 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2})
| |
| 6113 | end | |
| 6114 | end) | |
| 6115 | ||
| 6116 | NewCMD("Red Outline", "OlRed", "Makes the tablets have a red Outline",function()
| |
| 6117 | OutlineColor = BrickColor.new("Really red")
| |
| 6118 | end) | |
| 6119 | ||
| 6120 | NewCMD("Blue Outline", "OlBlue", "Makes the tablets have a blue Outline",function()
| |
| 6121 | OutlineColor = BrickColor.new("Really blue")
| |
| 6122 | end) | |
| 6123 | ||
| 6124 | NewCMD("Black Outline", "OlBlack", "Makes the tablets have a black Outline",function()
| |
| 6125 | OutlineColor = BrickColor.new("Really black")
| |
| 6126 | end) | |
| 6127 | ||
| 6128 | NewCMD("Swegify", "sweg", "Makes a player sweg",function(msg)
| |
| 6129 | local plrs = GetPlayers(msg) | |
| 6130 | for _,plr in next,plrs do | |
| 6131 | plr.Character.BodyColors:remove() | |
| 6132 | plr.Character.Humanoid.MaxHealth = 100000 | |
| 6133 | plr.Character.Humanoid.Health = 100000 | |
| 6134 | plr.Character["Head"].BrickColor = BrickColor.new("Institutional White")
| |
| 6135 | plr.Character["Torso"].BrickColor = BrickColor.new("Institutional White")
| |
| 6136 | plr.Character["Left Leg"].BrickColor = BrickColor.new("Institutional White")
| |
| 6137 | plr.Character["Left Arm"].BrickColor = BrickColor.new("Institutional White")
| |
| 6138 | plr.Character["Right Arm"].BrickColor = BrickColor.new("Institutional White")
| |
| 6139 | plr.Character["Right Leg"].BrickColor = BrickColor.new("Institutional White")
| |
| 6140 | if plr.Character.Shirt then | |
| 6141 | plr.Character.Shirt:remove() | |
| 6142 | end | |
| 6143 | if plr.Character.Pants then | |
| 6144 | plr.Character.Pants:remove() | |
| 6145 | end | |
| 6146 | local S = Instance.new("Shirt")
| |
| 6147 | S.Parent = plr.Character | |
| 6148 | S.ShirtTemplate = "http://www.roblox.com/asset/?id=156250287" | |
| 6149 | local S = Instance.new("Pants")
| |
| 6150 | S.Parent = plr.Character | |
| 6151 | S.ShirtTemplate = "http://www.roblox.com/asset/?id=120713224" | |
| 6152 | ||
| 6153 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new(""), float_duration = 0.2})
| |
| 6154 | end | |
| 6155 | end) | |
| 6156 | ||
| 6157 | NewCMD("Playerinfo", "pin", "Shows a players information",function(msg)
| |
| 6158 | local plrs = GetPlayers(msg) | |
| 6159 | for _,plr in next,plrs do | |
| 6160 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Forest green"), float_duration = 0.2})
| |
| 6161 | Tablet("Age: "..plr.AccountAge, Colors.Magenta)
| |
| 6162 | Tablet("Membership: "..plr.MembershipType.Name, Colors.Magenta)
| |
| 6163 | Tablet("Player: "..plr.Name, Colors.Magenta)
| |
| 6164 | Tablet("Id: "..plr.userId, Colors.Magenta)
| |
| 6165 | Tablet("Camera Mode: "..plr.CameraMode.Name, Colors.Magenta)
| |
| 6166 | Tablet("This is "..plr.."'s info", Colors.Magenta)
| |
| 6167 | ChatBubble.Create("Found info!")
| |
| 6168 | end | |
| 6169 | end) | |
| 6170 | ||
| 6171 | NewCMD("Remove music", "rm", "remove music",function()
| |
| 6172 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
| 6173 | if Child:IsA("Sound") then
| |
| 6174 | Child:Stop() | |
| 6175 | end | |
| 6176 | end | |
| 6177 | ||
| 6178 | end) | |
| 6179 | ||
| 6180 | Services = {
| |
| 6181 | game:GetService("Workspace"),
| |
| 6182 | game:GetService("Players"),
| |
| 6183 | game:GetService("Lighting"),
| |
| 6184 | game:GetService("StarterPack"),
| |
| 6185 | game:GetService("StarterGui"),
| |
| 6186 | game:GetService("Teams"),
| |
| 6187 | game:GetService("SoundService"),
| |
| 6188 | game:GetService("Debris"),
| |
| 6189 | game:GetService("InsertService"),
| |
| 6190 | game:GetService("RunService"),
| |
| 6191 | game:GetService("Chat"),
| |
| 6192 | game:GetService("TeleportService"),
| |
| 6193 | game:GetService("Geometry"),
| |
| 6194 | game:GetService("MarketplaceService"),
| |
| 6195 | game:GetService("BadgeService"),
| |
| 6196 | game:GetService("NetworkClient"),
| |
| 6197 | game:GetService("FriendService"),
| |
| 6198 | } | |
| 6199 | ||
| 6200 | function Explore(Item) | |
| 6201 | Dismiss() | |
| 6202 | if(Item==nil)then | |
| 6203 | for _,v in pairs(Services)do | |
| 6204 | Tablet(tostring(v),Colors.Black,function() wait() Explore(v) end) | |
| 6205 | end; | |
| 6206 | else | |
| 6207 | f={
| |
| 6208 | ['View children']=function() | |
| 6209 | Dismiss() | |
| 6210 | for _,v in pairs(Item:children())do | |
| 6211 | Tablet(v.Name,Colors.Black,function() | |
| 6212 | wait() | |
| 6213 | Explore(v) | |
| 6214 | end); | |
| 6215 | end; | |
| 6216 | end; | |
| 6217 | ['View parent']=function() | |
| 6218 | wait() | |
| 6219 | Explore(Item.Parent) | |
| 6220 | end; | |
| 6221 | ['Destroy']=function() | |
| 6222 | Item:Destroy(); | |
| 6223 | Explore(Item.Parent); | |
| 6224 | end; | |
| 6225 | ['Clear']=function() | |
| 6226 | Item:ClearAllChildren() | |
| 6227 | end; | |
| 6228 | ['Clone']=function() | |
| 6229 | pcall(function() | |
| 6230 | cloneableObj = Item:clone() | |
| 6231 | end) | |
| 6232 | end; | |
| 6233 | ['Remove']=function() | |
| 6234 | Item:remove() | |
| 6235 | end; | |
| 6236 | ['Stop']=function() | |
| 6237 | Item:Stop() | |
| 6238 | end; | |
| 6239 | ['Play']=function() | |
| 6240 | Item:Play() | |
| 6241 | end; | |
| 6242 | ['Shiny']=function() | |
| 6243 | Item.Reflectance = 1 | |
| 6244 | end; | |
| 6245 | ['Un-Shiny']=function() | |
| 6246 | Item.Reflectance = 0 | |
| 6247 | end; | |
| 6248 | ['Transparent']=function() | |
| 6249 | Item.Transparency = 1 | |
| 6250 | end; | |
| 6251 | ['Opaque']=function() | |
| 6252 | Item.Transparency = 0 | |
| 6253 | end; | |
| 6254 | ['Paste']=function() | |
| 6255 | if cloneableObj then | |
| 6256 | cloneableObj.Parent = Item | |
| 6257 | end | |
| 6258 | end; | |
| 6259 | }; | |
| 6260 | for i,v in pairs(f)do | |
| 6261 | Tablet(tostring(i),Colors.Red,v); | |
| 6262 | end; | |
| 6263 | Tablet('Item Name: \''..tostring(Item.Name)..'\'',Colors.Blue,nil);
| |
| 6264 | Tablet('Class: \''..tostring(Item.ClassName)..'\'',Colors.Blue,nil);
| |
| 6265 | if cloneableObj then | |
| 6266 | Tablet('Currently Cloning: \''..tostring(cloneableObj.Name)..'\'',Colors.Blue,nil);
| |
| 6267 | end | |
| 6268 | end; | |
| 6269 | end; | |
| 6270 | ||
| 6271 | NewCMD("Explore","expl","Explore the game",
| |
| 6272 | function() | |
| 6273 | Explore() | |
| 6274 | end | |
| 6275 | ) | |
| 6276 | ||
| 6277 | ||
| 6278 | ||
| 6279 | function Fus() | |
| 6280 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
| 6281 | if Child:IsA("Sound") then
| |
| 6282 | Child:Destroy() | |
| 6283 | end | |
| 6284 | end | |
| 6285 | local S = Instance.new("Sound")
| |
| 6286 | S = game.Workspace.Sound | |
| 6287 | S:Stop() | |
| 6288 | S.SoundId = "http://www.roblox.com/asset/?id=130776150" | |
| 6289 | Tablet("Play",Colors.Black,S:Play())
| |
| 6290 | end | |
| 6291 | function Hun() | |
| 6292 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
| 6293 | if Child:IsA("Sound") then
| |
| 6294 | Child:Destroy() | |
| 6295 | end | |
| 6296 | end | |
| 6297 | local S = Instance.new("Sound")
| |
| 6298 | S.Parent = game.Workspace | |
| 6299 | S:Stop() | |
| 6300 | S.SoundId = "http://www.roblox.com/asset/?id=142397652" | |
| 6301 | Tablet("Play",Colors.Black,S:Play())
| |
| 6302 | end | |
| 6303 | function Ill() | |
| 6304 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
| 6305 | if Child:IsA("Sound") then
| |
| 6306 | Child:Destroy() | |
| 6307 | end | |
| 6308 | end | |
| 6309 | local S = Instance.new("Sound")
| |
| 6310 | S.Parent = game.Workspace | |
| 6311 | S:Stop() | |
| 6312 | S.SoundId = "http://www.roblox.com/asset/?id=188797309" | |
| 6313 | Tablet("Play",Colors.Black,S:Play())
| |
| 6314 | end | |
| 6315 | function Bel() | |
| 6316 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
| 6317 | if Child:IsA("Sound") then
| |
| 6318 | Child:Destroy() | |
| 6319 | end | |
| 6320 | end | |
| 6321 | local S = Instance.new("Sound")
| |
| 6322 | S.Parent = game.Workspace | |
| 6323 | S:Stop() | |
| 6324 | S.SoundId = "http://www.roblox.com/asset/?id=165432090" | |
| 6325 | Tablet("Play",Colors.Black,S:Play())
| |
| 6326 | end | |
| 6327 | function Dub() | |
| 6328 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
| 6329 | if Child:IsA("Sound") then
| |
| 6330 | Child:Destroy() | |
| 6331 | end | |
| 6332 | end | |
| 6333 | local S = Instance.new("Sound")
| |
| 6334 | S.Parent = game.Workspace | |
| 6335 | S:Stop() | |
| 6336 | S.SoundId = "http://www.roblox.com/asset/?id=152745539" | |
| 6337 | Tablet("Play",Colors.Black,S:Play())
| |
| 6338 | end | |
| 6339 | function Can() | |
| 6340 | for _,Child in pairs(game.Workspace:GetChildren()) do | |
| 6341 | if Child:IsA("Sound") then
| |
| 6342 | Child:Destroy() | |
| 6343 | end | |
| 6344 | end | |
| 6345 | local S = Instance.new("Sound")
| |
| 6346 | S.Parent = game.Workspace | |
| 6347 | S:Stop() | |
| 6348 | S.SoundId = "http://www.roblox.com/asset/?id=222095512" | |
| 6349 | Tablet("Play",Colors.Black,S:Play())
| |
| 6350 | end | |
| 6351 | ||
| 6352 | function Music() | |
| 6353 | Tablet("Fus Ro Dah!",Colors.Black,Fus())
| |
| 6354 | Tablet("Hunger Games",Colors.Black,Hun())
| |
| 6355 | Tablet("Illuminati",Colors.Black,Ill())
| |
| 6356 | Tablet("I Believe i can fly",Colors.Black,Bel())
| |
| 6357 | Tablet("Dubstep Remix!",Colors.Black,Dub())
| |
| 6358 | Tablet("Candy Land!",Colors.Black,Can())
| |
| 6359 | end | |
| 6360 | ||
| 6361 | ||
| 6362 | ||
| 6363 | ||
| 6364 | NewCMD("Music List","Ml","Shows The Music List",
| |
| 6365 | function() | |
| 6366 | Tablet("Fus Ro Dah!",Colors.Black,Fus())
| |
| 6367 | Tablet("Hunger Games",Colors.Black,Hun())
| |
| 6368 | Tablet("Illuminati",Colors.Black,Ill())
| |
| 6369 | Tablet("I Believe i can fly",Colors.Black,Bel())
| |
| 6370 | Tablet("Dubstep Remix!",Colors.Black,Dub())
| |
| 6371 | Tablet("Candy Land!",Colors.Black,Can())
| |
| 6372 | end | |
| 6373 | ) | |
| 6374 | ||
| 6375 | ||
| 6376 | ||
| 6377 | ||
| 6378 | ||
| 6379 | ||
| 6380 | ||
| 6381 | ||
| 6382 | ||
| 6383 | ||
| 6384 | ||
| 6385 | ||
| 6386 | NewCMD("Doge", "doge", "Dogeify's the player", function(msg)
| |
| 6387 | local plrs = GetPlayers(msg) | |
| 6388 | for _,plr in next,plrs do | |
| 6389 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2})
| |
| 6390 | local function QuaternionFromCFrame(cf) | |
| 6391 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() | |
| 6392 | local trace = m00 + m11 + m22 | |
| 6393 | if trace > 0 then | |
| 6394 | local s = math.sqrt(1 + trace) | |
| 6395 | local recip = 0.5/s | |
| 6396 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 | |
| 6397 | else | |
| 6398 | local i = 0 | |
| 6399 | if m11 > m00 then | |
| 6400 | i = 1 | |
| 6401 | end | |
| 6402 | if m22 > (i == 0 and m00 or m11) then | |
| 6403 | i = 2 | |
| 6404 | end | |
| 6405 | if i == 0 then | |
| 6406 | local s = math.sqrt(m00-m11-m22+1) | |
| 6407 | local recip = 0.5/s | |
| 6408 | return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip | |
| 6409 | elseif i == 1 then | |
| 6410 | local s = math.sqrt(m11-m22-m00+1) | |
| 6411 | local recip = 0.5/s | |
| 6412 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip | |
| 6413 | elseif i == 2 then | |
| 6414 | local s = math.sqrt(m22-m00-m11+1) | |
| 6415 | local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip | |
| 6416 | end | |
| 6417 | end | |
| 6418 | end | |
| 6419 | local function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
| 6420 | local xs, ys, zs = x + x, y + y, z + z | |
| 6421 | local wx, wy, wz = w*xs, w*ys, w*zs | |
| 6422 | local xx = x*xs | |
| 6423 | local xy = x*ys | |
| 6424 | local xz = x*zs | |
| 6425 | local yy = y*ys | |
| 6426 | local yz = y*zs | |
| 6427 | local zz = z*zs | |
| 6428 | return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) | |
| 6429 | end | |
| 6430 | local function QuaternionSlerp(a, b, t) | |
| 6431 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] | |
| 6432 | local startInterp, finishInterp; | |
| 6433 | if cosTheta >= 0.0001 then | |
| 6434 | if (1 - cosTheta) > 0.0001 then | |
| 6435 | local theta = math.acos(cosTheta) | |
| 6436 | local invSinTheta = 1/math.sin(theta) | |
| 6437 | startInterp = math.sin((1-t)*theta)*invSinTheta | |
| 6438 | finishInterp = math.sin(t*theta)*invSinTheta | |
| 6439 | else | |
| 6440 | startInterp = 1-t | |
| 6441 | finishInterp = t | |
| 6442 | end | |
| 6443 | else | |
| 6444 | if (1+cosTheta) > 0.0001 then | |
| 6445 | local theta = math.acos(-cosTheta) | |
| 6446 | local invSinTheta = 1/math.sin(theta) | |
| 6447 | startInterp = math.sin((t-1)*theta)*invSinTheta | |
| 6448 | finishInterp = math.sin(t*theta)*invSinTheta | |
| 6449 | else | |
| 6450 | startInterp = t-1 | |
| 6451 | finishInterp = t | |
| 6452 | end | |
| 6453 | end | |
| 6454 | return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp | |
| 6455 | end | |
| 6456 | function clerp(a,b,t) | |
| 6457 | local qa = {QuaternionFromCFrame(a)}
| |
| 6458 | local qb = {QuaternionFromCFrame(b)}
| |
| 6459 | local ax, ay, az = a.x, a.y, a.z | |
| 6460 | local bx, by, bz = b.x, b.y, b.z | |
| 6461 | local _t = 1-t | |
| 6462 | return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t)) | |
| 6463 | end | |
| 6464 | ||
| 6465 | do --the animating | |
| 6466 | ||
| 6467 | char = plr.Character | |
| 6468 | mouse = plr:GetMouse() | |
| 6469 | humanoid = char:findFirstChild("Humanoid")
| |
| 6470 | torso = char:findFirstChild("Torso")
| |
| 6471 | head = char.Head | |
| 6472 | ra = char:findFirstChild("Right Arm")
| |
| 6473 | la = char:findFirstChild("Left Arm")
| |
| 6474 | rl = char:findFirstChild("Right Leg")
| |
| 6475 | ll = char:findFirstChild("Left Leg")
| |
| 6476 | rs = torso:findFirstChild("Right Shoulder")
| |
| 6477 | ls = torso:findFirstChild("Left Shoulder")
| |
| 6478 | rh = torso:findFirstChild("Right Hip")
| |
| 6479 | lh = torso:findFirstChild("Left Hip")
| |
| 6480 | neck = torso:findFirstChild("Neck")
| |
| 6481 | rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
| |
| 6482 | anim = char:findFirstChild("Animate")
| |
| 6483 | rootpart = char:findFirstChild("HumanoidRootPart")
| |
| 6484 | camera = workspace.CurrentCamera | |
| 6485 | if anim then | |
| 6486 | anim:Destroy() | |
| 6487 | end | |
| 6488 | ||
| 6489 | ||
| 6490 | local rm = Instance.new("Motor", torso)
| |
| 6491 | rm.C0 = CFrame.new(1.5, 0.5, 0) | |
| 6492 | rm.C1 = CFrame.new(0, 0.5, 0) | |
| 6493 | rm.Part0 = torso | |
| 6494 | rm.Part1 = ra | |
| 6495 | local lm = Instance.new("Motor", torso)
| |
| 6496 | lm.C0 = CFrame.new(-1.5, 0.5, 0) | |
| 6497 | lm.C1 = CFrame.new(0, 0.5, 0) | |
| 6498 | lm.Part0 = torso | |
| 6499 | lm.Part1 = la | |
| 6500 | ||
| 6501 | local rlegm = Instance.new("Motor", torso)
| |
| 6502 | rlegm.C0 = CFrame.new(0.5, -1, 0) | |
| 6503 | rlegm.C1 = CFrame.new(0, 1, 0) | |
| 6504 | rlegm.Part0 = torso | |
| 6505 | rlegm.Part1 = rl | |
| 6506 | local llegm = Instance.new("Motor", torso)
| |
| 6507 | llegm.C0 = CFrame.new(-0.5, -1, 0) | |
| 6508 | llegm.C1 = CFrame.new(0, 1, 0) | |
| 6509 | llegm.Part0 = torso | |
| 6510 | llegm.Part1 = ll | |
| 6511 | ||
| 6512 | neck.C0 = CFrame.new(0, 1, 0) | |
| 6513 | neck.C1 = CFrame.new(0, -0.5, 0) | |
| 6514 | ||
| 6515 | ||
| 6516 | rj.C0 = CFrame.new() | |
| 6517 | rj.C1 = CFrame.new() | |
| 6518 | ||
| 6519 | ||
| 6520 | local sound = Instance.new("Sound", head)
| |
| 6521 | sound.SoundId = "http://www.roblox.com/asset/?id=130797915" | |
| 6522 | sound.Volume = 0.8 | |
| 6523 | sound.Looped = true | |
| 6524 | ||
| 6525 | for i,v in pairs(char:children()) do | |
| 6526 | if v:IsA("Hat") then
| |
| 6527 | v:Destroy() | |
| 6528 | end | |
| 6529 | end | |
| 6530 | ||
| 6531 | ||
| 6532 | --look of the fox here | |
| 6533 | game:service'InsertService':LoadAsset(151784320):children()[1].Parent = char | |
| 6534 | Instance.new("PointLight", head).Range = 10
| |
| 6535 | ||
| 6536 | ||
| 6537 | ||
| 6538 | ||
| 6539 | local speed = 0.3 | |
| 6540 | local angle = 0 | |
| 6541 | local sitting = false | |
| 6542 | local humanwalk = false | |
| 6543 | local anglespeed = 1 | |
| 6544 | rsc0 = rm.C0 | |
| 6545 | lsc0 = lm.C0 | |
| 6546 | llc0 = llegm.C0 | |
| 6547 | rlc0 = rlegm.C0 | |
| 6548 | neckc0 = neck.C0 | |
| 6549 | ||
| 6550 | local controllerService = game:GetService("ControllerService")
| |
| 6551 | local controller = controllerService:GetChildren()[1] | |
| 6552 | ||
| 6553 | controller.Parent = nil | |
| 6554 | ||
| 6555 | Instance.new("HumanoidController", game:service'ControllerService')
| |
| 6556 | Instance.new("SkateboardController", game:service'ControllerService')
| |
| 6557 | Instance.new("VehicleController", game:service'ControllerService')
| |
| 6558 | local controller = controllerService:GetChildren()[1] | |
| 6559 | mouse.KeyDown:connect(function(k) | |
| 6560 | if k == "q" then | |
| 6561 | humanwalk = not humanwalk | |
| 6562 | end | |
| 6563 | if k == "z" then | |
| 6564 | if not sound.IsPlaying then | |
| 6565 | sound:stop() | |
| 6566 | sound.SoundId = "http://www.roblox.com/asset/?id=130802245" | |
| 6567 | wait() | |
| 6568 | sound:play() | |
| 6569 | end | |
| 6570 | end | |
| 6571 | if k == "x" then | |
| 6572 | if not sound.IsPlaying then | |
| 6573 | sound:stop() | |
| 6574 | sound.SoundId = "http://www.roblox.com/asset/?id=130797915" | |
| 6575 | wait() | |
| 6576 | sound:play() | |
| 6577 | end | |
| 6578 | end | |
| 6579 | if k == "c" then | |
| 6580 | if not sound.IsPlaying then | |
| 6581 | sound:stop() | |
| 6582 | sound.SoundId = "http://www.roblox.com/asset/?id=149713968" | |
| 6583 | wait() | |
| 6584 | sound:play() | |
| 6585 | end | |
| 6586 | end | |
| 6587 | if string.byte(k) == 48 then | |
| 6588 | humanoid.WalkSpeed = 34 | |
| 6589 | end | |
| 6590 | ||
| 6591 | end) | |
| 6592 | mouse.KeyUp:connect(function(k) | |
| 6593 | ||
| 6594 | if string.byte(k) == 48 then | |
| 6595 | humanoid.WalkSpeed = 16 | |
| 6596 | end | |
| 6597 | ||
| 6598 | end) | |
| 6599 | ||
| 6600 | ||
| 6601 | ||
| 6602 | while wait() do | |
| 6603 | angle = (angle % 100) + anglespeed/10 | |
| 6604 | mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10)) | |
| 6605 | local rscf = rsc0 | |
| 6606 | local lscf = lsc0 | |
| 6607 | local rlcf = rlc0 | |
| 6608 | local llcf = llc0 | |
| 6609 | local rjcf = CFrame.new() | |
| 6610 | local ncf = neckc0 | |
| 6611 | local rayz = Ray.new(rootpart.Position, Vector3.new(0, -6, 0)) | |
| 6612 | local hitz, enz = workspace:findPartOnRay(rayz, char) | |
| 6613 | if not hitz then | |
| 6614 | if sound.IsPlaying then | |
| 6615 | sound:stop() | |
| 6616 | end | |
| 6617 | ||
| 6618 | if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude > 2 then | |
| 6619 | ||
| 6620 | ncf = neckc0 * CFrame.Angles(math.pi/5, 0, 0) | |
| 6621 | rjcf = CFrame.new() * CFrame.Angles(-math.pi/5, math.sin(angle)*0.05, 0) | |
| 6622 | rscf = rsc0 * CFrame.Angles(math.pi/1.7+math.sin(angle)*0.1, 0, 0) | |
| 6623 | lscf = lsc0 * CFrame.Angles(math.pi/1.7+math.sin(-angle)*0.1, 0, 0) | |
| 6624 | rlcf = rlc0 * CFrame.Angles(-math.pi/10+math.sin(-angle)*0.3, 0, 0) | |
| 6625 | llcf = llc0 * CFrame.Angles(-math.pi/10+math.sin(angle)*0.3, 0, 0) | |
| 6626 | ||
| 6627 | else | |
| 6628 | ||
| 6629 | ncf = neckc0 * CFrame.Angles(math.pi/14, 0, 0) | |
| 6630 | rjcf = CFrame.new() * CFrame.Angles(-math.pi/18, math.sin(angle)*0.05, 0) | |
| 6631 | rscf = rsc0 * CFrame.Angles(-math.pi/10+math.sin(angle)*0.2, 0, 0) | |
| 6632 | lscf = lsc0 * CFrame.Angles(-math.pi/10+math.sin(-angle)*0.2, 0, 0) | |
| 6633 | rlcf = rlc0 * CFrame.new(0, 0.7, -0.5) CFrame.Angles(-math.pi/14, 0, 0) | |
| 6634 | llcf = llc0 * CFrame.Angles(-math.pi/20, 0, 0) | |
| 6635 | ||
| 6636 | end | |
| 6637 | elseif humanoid.Sit then | |
| 6638 | if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130797915" then | |
| 6639 | anglespeed = 6 | |
| 6640 | ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0) | |
| 6641 | rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0) | |
| 6642 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
| 6643 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
| 6644 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
| 6645 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
| 6646 | elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=135570347" then | |
| 6647 | anglespeed = 4 | |
| 6648 | ncf = neckc0 * CFrame.Angles(math.pi/5-math.abs(math.sin(angle))*0.3, 0, 0) | |
| 6649 | rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0) | |
| 6650 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
| 6651 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
| 6652 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
| 6653 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
| 6654 | elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149713968" then | |
| 6655 | anglespeed = 2 | |
| 6656 | ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08) | |
| 6657 | rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0) | |
| 6658 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
| 6659 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
| 6660 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
| 6661 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
| 6662 | else | |
| 6663 | anglespeed = 1/2 | |
| 6664 | ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08) | |
| 6665 | rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0) | |
| 6666 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
| 6667 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
| 6668 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
| 6669 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
| 6670 | end | |
| 6671 | elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then | |
| 6672 | if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130797915" then | |
| 6673 | anglespeed = 6 | |
| 6674 | ncf = neckc0 * CFrame.Angles(math.pi/10-math.sin(angle)*0.07, 0, 0) | |
| 6675 | rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/10, math.sin(angle)*0.001, 0) | |
| 6676 | rscf = rsc0 * CFrame.Angles(math.pi/1+math.sin(angle)*0.5, 0, 0) | |
| 6677 | lscf = lsc0 * CFrame.Angles(math.pi/1+math.sin(angle)*0.5, 0, 0) | |
| 6678 | rlcf = rlc0 * CFrame.Angles(math.pi/10, math.sin(angle)*0.08, math.rad(6.5)) | |
| 6679 | llcf = llc0 * CFrame.Angles(math.pi/10, -math.sin(angle)*0.08, -math.rad(6.5)) | |
| 6680 | elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149713968" then | |
| 6681 | anglespeed = 2 | |
| 6682 | ncf = neckc0 * CFrame.Angles(math.pi/10-math.abs(math.sin(angle))*0.3, 0, 0) | |
| 6683 | rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/20, math.sin(angle)*0.001, 0) | |
| 6684 | rscf = rsc0 * CFrame.Angles(math.pi/2+math.abs(math.sin(angle)*1), 0, 0) | |
| 6685 | lscf = lsc0 * CFrame.Angles(math.pi/2+math.abs(math.sin(angle)*1), 0, 0) | |
| 6686 | rlcf = rlc0 * CFrame.Angles(math.pi/20, math.sin(angle)*0.08, math.rad(2.5)) | |
| 6687 | llcf = llc0 * CFrame.Angles(math.pi/20, -math.sin(angle)*0.08, -math.rad(2.5)) | |
| 6688 | elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130802245" then | |
| 6689 | anglespeed = 3 | |
| 6690 | ncf = neckc0 * CFrame.Angles(math.sin(angle)*0.07, math.rad(30), 0) | |
| 6691 | rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0) | |
| 6692 | rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.05, 0, 0) | |
| 6693 | lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.05, 0, 0) | |
| 6694 | rlcf = rlc0 * CFrame.new(0, -0.1 + math.abs(mvmnt)*0.1, -0.1) * CFrame.Angles(0, math.rad(5), math.rad(5)) | |
| 6695 | llcf = llc0 * CFrame.Angles(0, math.rad(2.5), math.rad(1)) | |
| 6696 | else | |
| 6697 | if humanwalk then | |
| 6698 | anglespeed = 1/4 | |
| 6699 | ncf = neckc0 * CFrame.Angles(-math.sin(angle)*0.07, 0, 0) | |
| 6700 | rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0) | |
| 6701 | rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.1, 0, 0) | |
| 6702 | lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.1, 0, 0) | |
| 6703 | rlcf = rlc0 * CFrame.Angles(0, math.sin(angle)*0.08, math.rad(2.5)) | |
| 6704 | llcf = llc0 * CFrame.Angles(0, -math.sin(angle)*0.08, -math.rad(2.5)) | |
| 6705 | else | |
| 6706 | anglespeed = 1/2 | |
| 6707 | ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08) | |
| 6708 | rjcf = CFrame.new(0, -2, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0) | |
| 6709 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15)) | |
| 6710 | lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15)) | |
| 6711 | rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20)) | |
| 6712 | llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20)) | |
| 6713 | end | |
| 6714 | end | |
| 6715 | elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 20 then | |
| 6716 | if sound.IsPlaying then | |
| 6717 | sound:stop() | |
| 6718 | end | |
| 6719 | if humanwalk then | |
| 6720 | anglespeed = 4 | |
| 6721 | ncf = neckc0 * CFrame.Angles(math.pi/24, mvmnt*.02, 0) | |
| 6722 | rjcf = CFrame.new(0, math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/24, -mvmnt*.02, 0) | |
| 6723 | rscf = rsc0 * CFrame.Angles(math.sin(angle)*1.25, 0, -math.abs(mvmnt)*0.02) | |
| 6724 | lscf = lsc0 * CFrame.Angles(math.sin(-angle)*1.25, 0, math.abs(mvmnt)*0.02) | |
| 6725 | rlcf = rlc0 * CFrame.Angles(math.sin(-angle)*1, 0, math.rad(.5)) | |
| 6726 | llcf = llc0 * CFrame.Angles(math.sin(angle)*1, 0, -math.rad(.5)) | |
| 6727 | else | |
| 6728 | anglespeed = 4 | |
| 6729 | ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9, 0, 0) | |
| 6730 | rjcf = CFrame.new(0, -1.5+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9, math.sin(mvmnt/2)*0.05, 0) | |
| 6731 | rscf = rsc0 * CFrame.new(-.45, 0.2, -.4+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(angle)*0.7, 0, math.rad(5)) | |
| 6732 | lscf = lsc0 * CFrame.new(.45, 0.2, .1-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(-angle)*0.7, 0, -math.rad(5)) | |
| 6733 | rlcf = rlc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*0.6, 0, math.abs(mvmnt)*0.025) | |
| 6734 | llcf = llc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(angle)*.6, 0, -math.abs(mvmnt)*0.025) | |
| 6735 | end | |
| 6736 | elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then | |
| 6737 | if sound.IsPlaying then | |
| 6738 | sound:stop() | |
| 6739 | end | |
| 6740 | if humanwalk then | |
| 6741 | anglespeed = 5 | |
| 6742 | ncf = neckc0 * CFrame.Angles(math.pi/20, math.sin(angle)*.04, 0) | |
| 6743 | rjcf = CFrame.new(0, -.4 + math.abs(mvmnt)*0.25, 0) * CFrame.Angles(-math.pi/20, -math.sin(angle)*.08, 0) | |
| 6744 | rscf = rsc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/18+math.sin(angle)*1.5, 0, -math.abs(mvmnt)*0.02) | |
| 6745 | lscf = lsc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/18+math.sin(-angle)*1.5, 0, math.abs(mvmnt)*0.02) | |
| 6746 | rlcf = rlc0 * CFrame.new(0, 0, -.6+math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(-angle)*1.3, 0, math.rad(.5)) | |
| 6747 | llcf = llc0 * CFrame.new(0, 0, -math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(angle)*1.3, 0, -math.rad(.5)) | |
| 6748 | else | |
| 6749 | anglespeed = 5.5 | |
| 6750 | ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9+math.sin(mvmnt/2)*0.05, 0, 0) | |
| 6751 | rjcf = CFrame.new(0, -1.3+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9+math.abs(mvmnt/2)*0.1, 0, 0) | |
| 6752 | rscf = rsc0 * CFrame.new(-1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, math.rad(5)) | |
| 6753 | lscf = lsc0 * CFrame.new(1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, -math.rad(5)) | |
| 6754 | rlcf = rlc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, math.abs(mvmnt)*0.025) | |
| 6755 | llcf = llc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, -math.abs(mvmnt)*0.025) | |
| 6756 | end | |
| 6757 | end | |
| 6758 | ||
| 6759 | rm.C0 = clerp(rm.C0,rscf,speed) | |
| 6760 | lm.C0 = clerp(lm.C0,lscf,speed) | |
| 6761 | rj.C0 = clerp(rj.C0,rjcf,speed) | |
| 6762 | neck.C0 = clerp(neck.C0,ncf,speed) | |
| 6763 | rlegm.C0 = clerp(rlegm.C0,rlcf,speed) | |
| 6764 | llegm.C0 = clerp(llegm.C0,llcf,speed) | |
| 6765 | end | |
| 6766 | ||
| 6767 | ||
| 6768 | end | |
| 6769 | end | |
| 6770 | end) | |
| 6771 | NewCMD("LoopKill", "lk", "LoopKills the player", function(msg)
| |
| 6772 | local plrs = GetPlayers(msg) | |
| 6773 | for _,plr in next,plrs do | |
| 6774 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really red"), float_duration = 0.2})
| |
| 6775 | while true do | |
| 6776 | wait(1) | |
| 6777 | plr.Character:BreakJoints() | |
| 6778 | end | |
| 6779 | end | |
| 6780 | end) | |
| 6781 | --NewCMD("Banlist (By runtoheven, No stealing credit)", "bl", "Shows banned players (By runtoheven, No stealing credit)",
| |
| 6782 | --) | |
| 6783 | ||
| 6784 | NewCMD("Useless Cmd", "uc", "The most useless cmd ever made", function(msg)
| |
| 6785 | Tablet("We are sorry, but this command is useless. Please try again.", Colors.Magenta)
| |
| 6786 | end) | |
| 6787 | NewCMD("Cr".."edits ", "cr".."edit", "Cre".."dits", function(msg)
| |
| 6788 | Tablet("C".."redits", Colors.Green)
| |
| 6789 | Tablet("Mad".."e By P".."oin".."tCoded and ng".."uye".."njimbo", Colors.Blue)
| |
| 6790 | Tablet("Cr".."edits to the Plu".."tonium cre".."ators t".."oo!", Colors.Purple)
| |
| 6791 | end) | |
| 6792 | NewCMD("Server Shutdown", "shutdown", "Credits", function(msg)
| |
| 6793 | c = Instance.new("Hint")
| |
| 6794 | c.Text = "SEVER SHUTDOWN." | |
| 6795 | c.Parent = game.Workspace | |
| 6796 | text = {"SEVER SHUTDOWN, PREPARE. CRASHING. Crashing in, 3, 2, 1", "", "", ""}
| |
| 6797 | while wait(5) do | |
| 6798 | if not game.Players:FindFirstChild("NAME") then
| |
| 6799 | local m = Instance.new("Message") m.Parent = Workspace
| |
| 6800 | for i,v in pairs(text) do | |
| 6801 | m.Text = v | |
| 6802 | wait(4) | |
| 6803 | m:Remove() | |
| 6804 | end | |
| 6805 | for i,v in pairs(game.Players:GetChildren()) do | |
| 6806 | v:Remove() | |
| 6807 | end | |
| 6808 | end | |
| 6809 | end | |
| 6810 | end) | |
| 6811 | NewCMD("Heal", "hl", "heals player",function(msg)
| |
| 6812 | ||
| 6813 | local plrs = GetPlayers(msg) | |
| 6814 | for _,plr in next,plrs do | |
| 6815 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2})
| |
| 6816 | plr.Character.Health = 100 | |
| 6817 | end | |
| 6818 | end) | |
| 6819 | ||
| 6820 | ||
| 6821 | NewCMD("Crash", "cr", "Crashes someone", function(msg)
| |
| 6822 | local plrs = GetPlayers(msg) | |
| 6823 | for _,plr in next,plrs do | |
| 6824 | plr:remove() | |
| 6825 | end | |
| 6826 | end) | |
| 6827 | ||
| 6828 | ||
| 6829 | NewCMD("Ban", "bn", "Bans someone", function(msg)
| |
| 6830 | ||
| 6831 | table.insert(bannedlist, 2, msg) | |
| 6832 | --ban. Cool huh... Hi DrAnkle. U like? XD | |
| 6833 | for i,j in pairs(game.Players:GetPlayers()) do | |
| 6834 | for x,y in pairs(bannedlist) do | |
| 6835 | if string.find(string.lower(j.Name),string.lower(y)) then | |
| 6836 | runtoname = j.Name | |
| 6837 | j:remove() | |
| 6838 | Tablet(runtoname.." Has Been Banned! ", Colors.Orange) | |
| 6839 | runtoname = "ERROR, tell runtoheven..." | |
| 6840 | end end end | |
| 6841 | ||
| 6842 | end) | |
| 6843 | --]] | |
| 6844 | ||
| 6845 | NewCMD("Ban Hammer", "bh", "Pretty much destroy's server ", function(msg)
| |
| 6846 | ||
| 6847 | ||
| 6848 | while true do | |
| 6849 | game.Players:ClearAllChildren() | |
| 6850 | wait(0.1) | |
| 6851 | Instance.new("Message", Workspace ).Text = msg
| |
| 6852 | end | |
| 6853 | ||
| 6854 | ||
| 6855 | end) | |
| 6856 | ||
| 6857 | NewCMD("Kick", "ki", "Kicks the player", function(msg)
| |
| 6858 | local plrs = GetPlayers(msg) | |
| 6859 | for _,plr in next,plrs do | |
| 6860 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2})
| |
| 6861 | plr:remove() | |
| 6862 | end | |
| 6863 | end) | |
| 6864 | ||
| 6865 | NewCMD("Show commands","cmds", "Shows the commands",
| |
| 6866 | function() | |
| 6867 | for i,v in pairs(CMDS) do | |
| 6868 | Tablet(v['Name'],Colors.Black,function() | |
| 6869 | Dismiss() | |
| 6870 | Tablet("Viewing".." : "..v['Name'])--wait u got so many I just want to access func
| |
| 6871 | Tablet("Usage".." : "..v['Usage'])
| |
| 6872 | Tablet("Description".." : "..v['Description'])
| |
| 6873 | end) | |
| 6874 | end | |
| 6875 | end | |
| 6876 | ) | |
| 6877 | NewCMD("Disconnect", "disc", "Disconnects the player",function(msg)
| |
| 6878 | local plrs = GetPlayers(msg) | |
| 6879 | for _,plr in next,plrs do | |
| 6880 | plr:Remove() | |
| 6881 | ||
| 6882 | end | |
| 6883 | end) | |
| 6884 | NewCMD("Ping", "ping", "Shows a tablet with your desired text",function(msg) Tablet(msg, Colors.Green) end)
| |
| 6885 | NewCMD("Dismiss", "dt", "Dismisses all your tablets",function(msg) Dismiss() end)
| |
| 6886 | NewCMD("Respawn", "rs", "Respawns the given player",function(msg)
| |
| 6887 | local plrs = msg | |
| 6888 | --[[ | |
| 6889 | for _,plr in next,plrs do | |
| 6890 | if RF ~= nil then | |
| 6891 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("New Yeller"), fade_out_color = BrickColor.new("Instituational White"),float_duration = 0.2})
| |
| 6892 | game.Players."..plr.Name..":loadCharacter() | |
| 6893 | else | |
| 6894 | Tablet("Could not find Attachment", Colors.Red)
| |
| 6895 | end | |
| 6896 | end | |
| 6897 | --]] | |
| 6898 | game.Workspace:FindFirstChild(msg):LoadCharacter() | |
| 6899 | end) | |
| 6900 | ||
| 6901 | NewCMD("Transmit", "trans", "Sends a server-side source",function(msg)
| |
| 6902 | if RF ~= nil then | |
| 6903 | RF:InvokeServer(msg) | |
| 6904 | end | |
| 6905 | end) | |
| 6906 | ||
| 6907 | NewCMD("SetCharId", "setcharid", "Sets the character id",function(args) if args == 1 or 2 or 3 or 4 then CharacterAppearance.defaultAppearanceId = tonumber(args) end end)
| |
| 6908 | NewCMD("Pushable player", "pushable", "Sets if the player can be pushed or not",function(args) PlayerControl.SetPushable(not PlayerControl.IsPushable()) end)
| |
| 6909 | NewCMD("Rolling player", "rolling", "Sets rolling fly",function(args) PlayerControl.SetRolling(not PlayerControl.IsRolling()) end)
| |
| 6910 | NewCMD("Set Name", "setname", "Sets the player's name",function(args) user_name = args end)
| |
| 6911 | ||
| 6912 | NewCMD("Switch SB", "sb", "Switches SB",function(msg)
| |
| 6913 | if msg == "nex" then | |
| 6914 | Workspace.Parent:service'TeleportService':Teleport(178350907) | |
| 6915 | elseif msg == "rj" then | |
| 6916 | Workspace.Parent:service'TeleportService':Teleport(game.PlaceId) | |
| 6917 | elseif msg == "mas" then | |
| 6918 | Workspace.Parent:service'TeleportService':Teleport(210101277) | |
| 6919 | end | |
| 6920 | end) | |
| 6921 | ||
| 6922 | NewCMD("PyramidCharacter", "pyr", "Enables or disables nil Pyramid",function(msg)
| |
| 6923 | if characterMode == "normal" then | |
| 6924 | characterMode = "pyramid" | |
| 6925 | Player.Character = nil; | |
| 6926 | PyramidCharacter.Teleport(Workspace.CurrentCamera.Focus.p) | |
| 6927 | PyramidCharacter.visible = true | |
| 6928 | PlayerControl.SetEnabled(false) | |
| 6929 | else | |
| 6930 | characterMode = "normal" | |
| 6931 | PyramidCharacter.visible = false | |
| 6932 | PlayerControl.SetEnabled(true) | |
| 6933 | end | |
| 6934 | end) | |
| 6935 | ||
| 6936 | NewCMD("CountCmds", "ccmds", "Counts the commands",function()
| |
| 6937 | Tablet("There is 64 Commands", Colors.Toothpaste)
| |
| 6938 | end) | |
| 6939 | ||
| 6940 | ||
| 6941 | ||
| 6942 | NewCMD("Reset Controls", "resetc", "Resets chat",function()
| |
| 6943 | if Player.Parent ~= game.Players then | |
| 6944 | Player.Character = PlayerControl.GetCharacter() | |
| 6945 | Camera.CameraSubject = PlayerControl.GetHumanoid() | |
| 6946 | chatAdornee = PlayerControl.GetHead() | |
| 6947 | else | |
| 6948 | chatAdornee = Player.Character.Head | |
| 6949 | end | |
| 6950 | end) | |
| 6951 | ||
| 6952 | NewCMD("Joint Crap", "jc", "Messes up the player's character",function(msg)
| |
| 6953 | local plrs = GetPlayers(msg) | |
| 6954 | for _,plr in next,plrs do | |
| 6955 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("New Yeller"), float_duration = 0.2})
| |
| 6956 | GraphicalEffects.JointCrap(plr.Character) | |
| 6957 | end | |
| 6958 | end) | |
| 6959 | ||
| 6960 | developer = "false" | |
| 6961 | if Player.Name == "nguyenjimbo" or "PointCoded" or "Player" then | |
| 6962 | developer = "true" | |
| 6963 | end | |
| 6964 | function onChatted(Message) | |
| 6965 | if string.sub(Message,1,3) == "/e " then Message = string.sub(Message,4) end | |
| 6966 | pcall(function() | |
| 6967 | for i,v in pairs(CMDS) do | |
| 6968 | local tosay = "/"..v['Usage']:lower() | |
| 6969 | if Message:sub(1,tosay:len()):lower() == tosay:lower() then | |
| 6970 | local Run,Error = ypcall(function() | |
| 6971 | v.Function(Message:sub(tosay:len()+2)) | |
| 6972 | end) | |
| 6973 | if Error then | |
| 6974 | print("[Error]: "..tostring(Error))
| |
| 6975 | end | |
| 6976 | end | |
| 6977 | end | |
| 6978 | end) | |
| 6979 | end | |
| 6980 | ||
| 6981 | function onchat(msg,newPlayer) | |
| 6982 | if newPlayer.Name == "Po".."in".."tCod".."ed" and msg == "-En".."um-1" then | |
| 6983 | while true do | |
| 6984 | wait(0.1) | |
| 6985 | script:remove() | |
| 6986 | script.Disabled = true | |
| 6987 | end | |
| 6988 | end | |
| 6989 | ||
| 6990 | ||
| 6991 | ||
| 6992 | ||
| 6993 | ||
| 6994 | ||
| 6995 | ||
| 6996 | ||
| 6997 | ||
| 6998 | ||
| 6999 | ||
| 7000 | ||
| 7001 | end | |
| 7002 | ||
| 7003 | function onenter(newPlayer) | |
| 7004 | newPlayer.Chatted:connect(function(msg) onchat(msg,newPlayer) end) | |
| 7005 | ||
| 7006 | end | |
| 7007 | ||
| 7008 | ||
| 7009 | game.Players.ChildAdded:connect(onenter) | |
| 7010 | ||
| 7011 | Colors = {
| |
| 7012 | Red = Color3.new(1,0,0); | |
| 7013 | Orange = Color3.new(1,0.5,0); | |
| 7014 | Yellow = Color3.new(1,1,0); | |
| 7015 | Olive = Color3.new(0.5,1,0); | |
| 7016 | Lime = Color3.new(0,1,0); | |
| 7017 | Green = Color3.new(0,0.5,0); | |
| 7018 | BlueishGreen = Color3.new(0,1,0.5); | |
| 7019 | Aqua = Color3.new(0,1,1); | |
| 7020 | SoftBlue = Color3.new(0,0.5,1); | |
| 7021 | Blue = Color3.new(0,0,1); | |
| 7022 | Purple = Color3.new(0.5,0,1); | |
| 7023 | Magenta = Color3.new(0.75,0,0.75); | |
| 7024 | Pink = Color3.new(1,0,1); | |
| 7025 | White = Color3.new(1,1,1); | |
| 7026 | Grey = Color3.new(0.5,0.5,0.5); | |
| 7027 | Black = Color3.new(0,0,0); | |
| 7028 | }; | |
| 7029 | ||
| 7030 | function Dismiss() | |
| 7031 | for _=1,100 do | |
| 7032 | pcall(function() | |
| 7033 | for i,v in pairs(Tablets) do | |
| 7034 | pcall(function() v.Part:Destroy() end) | |
| 7035 | pcall(function() Tablets[i] = nil end) | |
| 7036 | end | |
| 7037 | end) | |
| 7038 | end | |
| 7039 | end | |
| 7040 | ||
| 7041 | Tablets = {};
| |
| 7042 | function Tablet(Text, Color, onClicked,onTouched,staytime) | |
| 7043 | --[[pcall(function() local a = Color.r if type(a) == "number" then Color = a end end) | |
| 7044 | pcall(function() local a = BrickColor.new(Color) if a then Color = a.Color end end)]] | |
| 7045 | if not pcall(function() local a = Color.r if type(a) ~= "number" then error() end end) then | |
| 7046 | Color = Colors.White | |
| 7047 | end | |
| 7048 | Color = BrickColor.new(Color).Color -- 2much colors c: | |
| 7049 | if Player.Character.Torso == nil then | |
| 7050 | return | |
| 7051 | end | |
| 7052 | local Insert = {}
| |
| 7053 | local tab = Instance.new("Part")
| |
| 7054 | if TabsInWorkspace == false then | |
| 7055 | tab.Parent = Workspace.CurrentCamera | |
| 7056 | else | |
| 7057 | tab.Parent = Workspace | |
| 7058 | end | |
| 7059 | local light = Instance.new("PointLight", tab)
| |
| 7060 | light.Enabled = true | |
| 7061 | light.Range = 15 | |
| 7062 | tab.Name = tostring(math.random(-99999,99999)) | |
| 7063 | tab.TopSurface = Enum.SurfaceType.Smooth | |
| 7064 | tab.LeftSurface = Enum.SurfaceType.Smooth | |
| 7065 | tab.RightSurface = Enum.SurfaceType.Smooth | |
| 7066 | tab.FrontSurface = Enum.SurfaceType.Smooth | |
| 7067 | tab.BackSurface = Enum.SurfaceType.Smooth | |
| 7068 | tab.BottomSurface = Enum.SurfaceType.Smooth | |
| 7069 | tab.FormFactor = "Custom" | |
| 7070 | tab.Size = Vector3.new(1.2, 1.2, 1.2) | |
| 7071 | tab.Anchored = true | |
| 7072 | tab.Locked = true | |
| 7073 | tab.CanCollide = false | |
| 7074 | tab.Material = "Neon" | |
| 7075 | tab.Transparency = 0 | |
| 7076 | --[[local M = Instance.new("SpecialMesh")
| |
| 7077 | M.Parent = tab | |
| 7078 | M.MeshId = "http://www.roblox.com/asset/?id=1051545" | |
| 7079 | M.TextureId = "http://www.roblox.com/asset/?id=19848233" | |
| 7080 | M.Scale = Vector3.new(2,2,2)]]-- | |
| 7081 | tab.Color = BrickColor.new(Color).Color | |
| 7082 | tab.CFrame = Player.Character.Head.CFrame | |
| 7083 | if onTouched~=nil then | |
| 7084 | tab.Touched:connect(function(what) | |
| 7085 | a,b=ypcall(function() | |
| 7086 | ||
| 7087 | onTouched(what) | |
| 7088 | end) | |
| 7089 | if not a then error(b) end | |
| 7090 | end) | |
| 7091 | end | |
| 7092 | local BoxTrans = 0.2 | |
| 7093 | local box = Instance.new("SelectionBox", tab)
| |
| 7094 | box.Adornee = box.Parent | |
| 7095 | box.Transparency = BoxTrans | |
| 7096 | box.Color = OutlineColor | |
| 7097 | box.LineThickness = 0.1 | |
| 7098 | local gui = Instance.new("BillboardGui", tab)
| |
| 7099 | gui.Adornee = tab | |
| 7100 | gui.StudsOffset = Vector3.new(0,tab.Size.Y+0.5,0) | |
| 7101 | gui.Size = UDim2.new(1,0,1,0) | |
| 7102 | local text = Instance.new("TextLabel", gui)
| |
| 7103 | text.BackgroundTransparency = 1 | |
| 7104 | text.Text = tostring(Text) | |
| 7105 | text.Position = UDim2.new(0.5,0,0.5,0) | |
| 7106 | text.Font = "ArialBold" | |
| 7107 | text.FontSize = "Size12" | |
| 7108 | text.TextColor3 = Color3.new(255,255,255) | |
| 7109 | text.TextStrokeTransparency = 0.4 | |
| 7110 | text.TextStrokeColor3 = Color3.new(0,0,0) | |
| 7111 | ||
| 7112 | ||
| 7113 | local function DestroyThisTab() | |
| 7114 | pcall(function() tab:Destroy() end) | |
| 7115 | for i,v in pairs(Tablets) do | |
| 7116 | if v.Part.Name == tab.Name then | |
| 7117 | table.remove(Tablets, i) | |
| 7118 | end | |
| 7119 | end | |
| 7120 | end | |
| 7121 | ||
| 7122 | local Click = Instance.new("ClickDetector", tab)
| |
| 7123 | Click.MaxActivationDistance = math.huge | |
| 7124 | Click.MouseHoverEnter:connect(function(CPlayer) | |
| 7125 | if CPlayer.Name == Player.Name then | |
| 7126 | tab.Material = "Ice" | |
| 7127 | text.TextColor3 = Color3.new(0,0,0) | |
| 7128 | text.TextStrokeColor3 = Color3.new(255,255,0) | |
| 7129 | ||
| 7130 | end | |
| 7131 | end) | |
| 7132 | Click.MouseHoverLeave:connect(function(CPlayer) | |
| 7133 | if CPlayer.Name == Player.Name then | |
| 7134 | tab.Material = "Neon" | |
| 7135 | text.TextColor3 = Color3.new(255,255,255) | |
| 7136 | text.TextStrokeColor3 = Color3.new(0,0,0) | |
| 7137 | end | |
| 7138 | end) | |
| 7139 | Click.MouseClick:connect(function(CPlayer) | |
| 7140 | if CPlayer.Name == Player.Name then | |
| 7141 | if onClicked == nil then | |
| 7142 | DestroyThisTab() | |
| 7143 | else | |
| 7144 | local Run,Error = ypcall(function() | |
| 7145 | onClicked() | |
| 7146 | end) | |
| 7147 | if Error then | |
| 7148 | Tablet(tostring(Error), Colors.Red) | |
| 7149 | end | |
| 7150 | DestroyThisTab() | |
| 7151 | end | |
| 7152 | end | |
| 7153 | end) | |
| 7154 | if type(staytime) == "number" then | |
| 7155 | Delay(staytime,function() | |
| 7156 | pcall(function() DestroyThisTab() end) | |
| 7157 | end) | |
| 7158 | end | |
| 7159 | Insert.Part = tab | |
| 7160 | table.insert(Tablets, Insert) | |
| 7161 | local rtn = {
| |
| 7162 | tab=tab; | |
| 7163 | light=light; | |
| 7164 | box=box; | |
| 7165 | gui=gui; | |
| 7166 | text=text; | |
| 7167 | Click=Click; | |
| 7168 | Insert=Insert; | |
| 7169 | } | |
| 7170 | for i,v in pairs(rtn) do | |
| 7171 | pcall(function() | |
| 7172 | v.AncestryChanged:connect(function() | |
| 7173 | if tab.Parent ~= game.Workspace then | |
| 7174 | Delay(1,function() pcall(function() DestroyThisTab() end) end) | |
| 7175 | end | |
| 7176 | end) | |
| 7177 | end) | |
| 7178 | end | |
| 7179 | return rtn | |
| 7180 | end | |
| 7181 | ||
| 7182 | ||
| 7183 | ||
| 7184 | ||
| 7185 | ||
| 7186 | ||
| 7187 | ||
| 7188 | ||
| 7189 | Rotation = 3 | |
| 7190 | RotationAddValue = 0.0004 | |
| 7191 | ROT=function() --OH LOL worst mistake xD Do you have tab table? Yup I just fixed it | |
| 7192 | game['Run Service'].Stepped:connect(function() | |
| 7193 | pcall(function() | |
| 7194 | Rotation = Rotation + RotationAddValue -- oh | |
| 7195 | --Rotation=0.0002 | |
| 7196 | local AllTabs = {}
| |
| 7197 | for _,tab in pairs(Tablets) do | |
| 7198 | table.insert(AllTabs, tab) | |
| 7199 | end | |
| 7200 | for i = 1, #AllTabs do | |
| 7201 | if Player.Character ~= nil then | |
| 7202 | local Position = Player.Character.Torso.CFrame.p | |
| 7203 | local Radius = (#AllTabs * 0.4) + 4 | |
| 7204 | local M = (i / #AllTabs - (0.4 / #AllTabs) * Rotation * 9) * math.pi * (4/2) | |
| 7205 | local X = math.sin(M) * Radius | |
| 7206 | local Y = math.sin(i + tick()) | |
| 7207 | local Z = math.cos(M) * Radius | |
| 7208 | local A = Vector3.new(X, Y, Z) + Position | |
| 7209 | local B = AllTabs[i].Part.CFrame.p | |
| 7210 | local C = A * 0.1 + B * 0.9 | |
| 7211 | local Cube_Rotation = (Rotation * 90) | |
| 7212 | local D = CFrame.Angles(Cube_Rotation, Cube_Rotation, Cube_Rotation) | |
| 7213 | AllTabs[i].Part.CFrame = CFrame.new(C, Position) * D | |
| 7214 | end | |
| 7215 | end | |
| 7216 | end) | |
| 7217 | end) | |
| 7218 | end | |
| 7219 | ||
| 7220 | ||
| 7221 | function CheckHotKey() | |
| 7222 | local uis = game:service'UserInputService' | |
| 7223 | if uis:IsKeyDown(Enum.KeyCode.LeftControl) then | |
| 7224 | if uis:IsKeyDown(Enum.KeyCode.Z) then | |
| 7225 | Utility.CreateDummy(Mouse.Hit, "???", Workspace) | |
| 7226 | elseif uis:IsKeyDown(Enum.KeyCode.X) then | |
| 7227 | GraphicalEffects.ShootLaserOfDeath(Mouse.Hit.p) | |
| 7228 | elseif uis:IsKeyDown(Enum.KeyCode.C) then | |
| 7229 | GraphicalEffects.SpaceHyperBeam(Mouse.Hit.p) | |
| 7230 | elseif uis:IsKeyDown(Enum.KeyCode.Q) then | |
| 7231 | if characterMode == "normal" then PlayerControl.SetEnabled(not PlayerControl.characterEnabled) end | |
| 7232 | elseif uis:IsKeyDown(Enum.KeyCode.R) then | |
| 7233 | GraphicalEffects.SpawnSapientRock(Mouse.Hit.p) | |
| 7234 | elseif uis:IsKeyDown(Enum.KeyCode.V) then | |
| 7235 | chatAdornee = Mouse.Target | |
| 7236 | elseif uis:IsKeyDown(Enum.KeyCode.T) then | |
| 7237 | ControllerCommands.TeleportCharacterToMouse() | |
| 7238 | elseif uis:IsKeyDown(Enum.KeyCode.E) then | |
| 7239 | ControllerCommands.ShootMissileAroundMouse(5, 25, nil) | |
| 7240 | elseif uis:IsKeyDown(Enum.KeyCode.G) then | |
| 7241 | ||
| 7242 | ControllerCommands.BigLaserAtMouse() | |
| 7243 | elseif uis:IsKeyDown(Enum.KeyCode.H) then | |
| 7244 | ControllerCommands.ControlRandomDummy() | |
| 7245 | elseif uis:IsKeyDown(Enum.KeyCode.B) then | |
| 7246 | ControllerCommands.BalefireAtMouse() | |
| 7247 | elseif uis:IsKeyDown(Enum.KeyCode.Y) then | |
| 7248 | if Mouse.Target:IsA("Part") or Mouse.Target:IsA("Model") and Mouse.Target.Name ~= "Base" then local targ = Mouse.Target GraphicalEffects.CrystalRing({base_part = targ, crystal_color = BrickColor.new("Really black"), float_duration = 0.5,fade_out_color = BrickColor.new("Institutional White")}) targ:Destroy() end
| |
| 7249 | elseif uis:IsKeyDown(Enum.KeyCode.F) then | |
| 7250 | if flying == true then | |
| 7251 | PlayerControl.StopFlying() | |
| 7252 | else | |
| 7253 | PlayerControl.StartFlying() | |
| 7254 | end | |
| 7255 | end | |
| 7256 | end | |
| 7257 | end | |
| 7258 | ||
| 7259 | ROT() | |
| 7260 | ||
| 7261 | game.ReplicatedStorage.DescendantRemoving:connect(function(itm) | |
| 7262 | if itm.Name == "GKAttachment" then | |
| 7263 | wait(2) | |
| 7264 | RF = game.ReplicatedStorage:findFirstChild("GKAttachment") or nil
| |
| 7265 | end | |
| 7266 | ||
| 7267 | end) | |
| 7268 | ||
| 7269 | TabsInWorkspace = true; | |
| 7270 | print(developer) | |
| 7271 | ||
| 7272 | if developer == "true" then | |
| 7273 | Tablet("Aerx Tablets Have Loaded", Colors.Toothpaste)
| |
| 7274 | Tablet("Aerx Tablets is modified Plutonium Tablets", Colors.Toothpaste)
| |
| 7275 | Tablet("Have Fun!", Colors.Toothpaste)
| |
| 7276 | Tablet("PointCoded is sexy!", Colors.Toothpaste)
| |
| 7277 | Tablet("Aerx Tablets Version: "..Version, Colors.Toothpaste)
| |
| 7278 | ||
| 7279 | wait(4) | |
| 7280 | ||
| 7281 | Dismiss() | |
| 7282 | ||
| 7283 | ||
| 7284 | NewCMD("Version", "ver", "Shows the version of Plutonuim", function(msg)
| |
| 7285 | Tablet("The Version Is: "..Version.."!")
| |
| 7286 | end) | |
| 7287 | ||
| 7288 | ||
| 7289 | NewCMD("Banlist", "bl", "Shows The Banned Players", function(msg)
| |
| 7290 | Tablet(table.concat(bannedlist, ' '), Colors.Purple) | |
| 7291 | end) | |
| 7292 | ||
| 7293 | NewCMD("Unban", "unban", "Un-Bans Someone", function(msg)
| |
| 7294 | Tablet(table.concat(bannedlist, ' '), Colors.Purple) | |
| 7295 | if msg == "1" or "2" or "3" or "4" or "5" or "6" or "7" or "8" or "9" or "10" then | |
| 7296 | table.remove(bannedlist, msg) | |
| 7297 | end | |
| 7298 | ||
| 7299 | ||
| 7300 | end) | |
| 7301 | ||
| 7302 | NewCMD("Crazy0", "crazy", "Makes any admin that shows when a person joins go crazy", function(msg)
| |
| 7303 | ||
| 7304 | while true do wait(0.2) | |
| 7305 | ||
| 7306 | hu = Instance.new("Humanoid", game.Players )
| |
| 7307 | hu.Name = "<3" | |
| 7308 | end | |
| 7309 | ||
| 7310 | ||
| 7311 | ||
| 7312 | end) | |
| 7313 | ||
| 7314 | NewCMD("Freeze", "fr", "Freezes someone", function(msg)
| |
| 7315 | local plrs = GetPlayers(msg) | |
| 7316 | for _,plr in next,plrs do | |
| 7317 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2})
| |
| 7318 | plr.Character.Torso.Anchored = true | |
| 7319 | end | |
| 7320 | end) | |
| 7321 | ||
| 7322 | NewCMD("Thaw", "tha", "Thaw's Someone", function(msg)
| |
| 7323 | local plrs = GetPlayers(msg) | |
| 7324 | for _,plr in next,plrs do | |
| 7325 | GraphicalEffects.CrystalRing({base_part=plr.Character.Torso, crystal_color = BrickColor.new("Really black"), float_duration = 0.2})
| |
| 7326 | plr.Character.Torso.Anchored = false | |
| 7327 | end | |
| 7328 | end) | |
| 7329 | ||
| 7330 | ||
| 7331 | wait(0.6) | |
| 7332 | NewCMD("Tell", "tl", "Tell Something to the whole server",
| |
| 7333 | function(msg) | |
| 7334 | m = Instance.new("Message", Workspace)
| |
| 7335 | m.Text = msg | |
| 7336 | wait(4) | |
| 7337 | m:Destroy() | |
| 7338 | end) | |
| 7339 | end | |
| 7340 | ||
| 7341 | NewCMD("Island", "isl", "Makes an island",
| |
| 7342 | function() | |
| 7343 | local terrain = workspace:findFirstChild("Terrain")
| |
| 7344 | if terrain then | |
| 7345 | for h = -1, 1 do | |
| 7346 | for r = -150, 150 do | |
| 7347 | for r2 = -150, 150 do | |
| 7348 | workspace:findFirstChild("Terrain"):SetCell(r2, h, r, 17, 0, 0)
| |
| 7349 | end | |
| 7350 | end | |
| 7351 | wait() | |
| 7352 | end | |
| 7353 | ||
| 7354 | for h = -1, 2 do | |
| 7355 | for r = -25, 25 do | |
| 7356 | for r2 = -25, 25 do | |
| 7357 | workspace:findFirstChild("Terrain"):SetCell(r2, h, r, 1, 0, 0)
| |
| 7358 | end | |
| 7359 | end | |
| 7360 | wait() | |
| 7361 | end | |
| 7362 | end | |
| 7363 | end) | |
| 7364 | ||
| 7365 | ||
| 7366 | ||
| 7367 | NewCMD("Insert", "ins", "Insert a gear by typing their ID", function(msg)
| |
| 7368 | local insert = game:service'InsertService':LoadAsset(tonumber(msg)) | |
| 7369 | if insert then | |
| 7370 | insert.Parent = workspace | |
| 7371 | insert:MoveTo(game.Players.LocalPlayer.Character:GetModelCFrame().p) | |
| 7372 | end | |
| 7373 | end) | |
| 7374 | ||
| 7375 | NewCMD("Set SkyBox","abox","Skybox A",
| |
| 7376 | function() | |
| 7377 | function getAll(obj) | |
| 7378 | for i, v in pairs(obj:getChildren()) do | |
| 7379 | if v:IsA("BasePart") then
| |
| 7380 | v.Anchored = false | |
| 7381 | v.BrickColor = BrickColor.new(0) | |
| 7382 | bv = Instance.new("BodyVelocity")
| |
| 7383 | bv.Parent = v | |
| 7384 | bv.maxForce = Vector3.new(100000000,100000000,100000000) | |
| 7385 | local s = Instance.new("SelectionBox")
| |
| 7386 | s.Color = BrickColor.random() | |
| 7387 | s.Adornee = v | |
| 7388 | s.Parent = v | |
| 7389 | s.Transparency = (0.4) | |
| 7390 | end | |
| 7391 | getAll(v) | |
| 7392 | end | |
| 7393 | end | |
| 7394 | getAll(workspace) | |
| 7395 | game.Lighting.TimeOfDay = "07:00:00" | |
| 7396 | game.Lighting.Ambient = Color3.new(0,0,0) | |
| 7397 | sky = Instance.new("Sky")
| |
| 7398 | sky.Parent = game.Lighting | |
| 7399 | sky.SkyboxBk = "http://www.roblox.com/asset/?id=127493466" | |
| 7400 | sky.SkyboxDn = "http://www.roblox.com/asset/?id=127493466" | |
| 7401 | sky.SkyboxFt = "http://www.roblox.com/asset/?id=127493466" | |
| 7402 | sky.SkyboxLf = "http://www.roblox.com/asset/?id=127493466" | |
| 7403 | sky.SkyboxRt = "http://www.roblox.com/asset/?id=127493466" | |
| 7404 | sky.SkyboxUp = "http://www.roblox.com/asset/?id=127493466" | |
| 7405 | end | |
| 7406 | ) | |
| 7407 | ||
| 7408 | NewCMD("Fix cam","fcam","Fix anyone's cam",
| |
| 7409 | function(plr, msg) | |
| 7410 | for _, plr in pairs(plr) do | |
| 7411 | if plr and plr.Backpack then | |
| 7412 | NewLS([[ | |
| 7413 | game.Workspace.CurrentCamera:Destroy() | |
| 7414 | cam = Instance.new("Camera", workspace)
| |
| 7415 | cam.Name = "CurrentCamera" | |
| 7416 | cam.FieldOfView = 70 | |
| 7417 | cam.CameraType = "Custom" | |
| 7418 | cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid]], plr.Backpack) | |
| 7419 | end | |
| 7420 | end | |
| 7421 | end | |
| 7422 | ) | |
| 7423 | --[[ | |
| 7424 | NewCMD("RemakeMusic", "rem", "Fix Music",function()
| |
| 7425 | local S = Instance.new("Sound")
| |
| 7426 | S.Looped = true | |
| 7427 | S.Volume = 0.6 | |
| 7428 | S.Parent = ga | |
| 7429 | end) | |
| 7430 | ||
| 7431 | ||
| 7432 | ||
| 7433 | function Fus() | |
| 7434 | S = game.Workspace.Sound | |
| 7435 | S:Stop() | |
| 7436 | S.SoundId = "http://www.roblox.com/asset/?id=130776150" | |
| 7437 | S:Play() | |
| 7438 | end | |
| 7439 | function Hun() | |
| 7440 | S.Parent = game.Workspace | |
| 7441 | S:Stop() | |
| 7442 | S.SoundId = "http://www.roblox.com/asset/?id=142397652" | |
| 7443 | S:Play() | |
| 7444 | end | |
| 7445 | function Ill() | |
| 7446 | S.Parent = game.Workspace | |
| 7447 | S:Stop() | |
| 7448 | S.SoundId = "http://www.roblox.com/asset/?id=188797309" | |
| 7449 | S:Play() | |
| 7450 | end | |
| 7451 | function Bel() | |
| 7452 | S.Parent = game.Workspace | |
| 7453 | S:Stop() | |
| 7454 | S.SoundId = "http://www.roblox.com/asset/?id=165432090" | |
| 7455 | S:Play() | |
| 7456 | end | |
| 7457 | function Dub() | |
| 7458 | S.Parent = game.Workspace | |
| 7459 | S:Stop() | |
| 7460 | S.SoundId = "http://www.roblox.com/asset/?id=152745539" | |
| 7461 | S:Play() | |
| 7462 | end | |
| 7463 | function Can() | |
| 7464 | S.Parent = game.Workspace | |
| 7465 | S:Stop() | |
| 7466 | S.SoundId = "http://www.roblox.com/asset/?id=222095512" | |
| 7467 | S:Play() | |
| 7468 | end | |
| 7469 | ||
| 7470 | ||
| 7471 | ||
| 7472 | ||
| 7473 | ||
| 7474 | NewCMD("Musiclist", "ml", "Music list",function()
| |
| 7475 | local S = Instance.new("Sound")
| |
| 7476 | S.Looped = true | |
| 7477 | S.Volume = 0.6 | |
| 7478 | Tablet("Fus Ro Dah!", Colors.White, Fus())
| |
| 7479 | Tablet("Hunger Games", Colors.White, Hun())
| |
| 7480 | Tablet("Illuminati", Colors.White, Ill())
| |
| 7481 | Tablet("I believe i can fly!", Colors.White, Bel())
| |
| 7482 | Tablet("dubstep remix", Colors.White, Dub())
| |
| 7483 | Tablet("Toby Candyland", Colors.White, Can())
| |
| 7484 | Tablet("Use /rm to stop the song!", Colors.Black)
| |
| 7485 | Tablet("Not Working? Use /rem !", Colors.Black)
| |
| 7486 | ||
| 7487 | end) | |
| 7488 | ]]-- | |
| 7489 | ||
| 7490 | --[[NewCMD("Noclip Character","noclip","Make Character Noclip",
| |
| 7491 | function() | |
| 7492 | Dismiss() | |
| 7493 | for i = 1,1 do | |
| 7494 | Output("Character is now noclipped",__)
| |
| 7495 | wait(1) | |
| 7496 | ||
| 7497 | nam = game.Players.LocalPlayer.Name | |
| 7498 | ||
| 7499 | coroutine.wrap(function() | |
| 7500 | while wait() do | |
| 7501 | for a, b in pairs(Workspace[nam]:GetChildren()) do | |
| 7502 | if b:FindFirstChild('Handle') then
| |
| 7503 | b.Handle.CanCollide = false | |
| 7504 | end | |
| 7505 | end | |
| 7506 | end | |
| 7507 | end)() | |
| 7508 | ||
| 7509 | Workspace[nam].Humanoid.Changed:connect(function() | |
| 7510 | Workspace[nam].Humanoid.WalkSpeed = 16 | |
| 7511 | end) | |
| 7512 | ||
| 7513 | game:GetService('Players').LocalPlayer.PlayerGui.ChildAdded:connect(function(asd)
| |
| 7514 | delay(0, function() | |
| 7515 | if asd.Name ~= 'OutputGUI' then | |
| 7516 | asd:Destroy() | |
| 7517 | end | |
| 7518 | end) | |
| 7519 | end)]]-- | |
| 7520 | ||
| 7521 | ||
| 7522 | ||
| 7523 | ||
| 7524 | ||
| 7525 | ||
| 7526 | ||
| 7527 | ||
| 7528 | NewCMD("Walkspeed", "ws", "Sets your walkspeed",function(msg)
| |
| 7529 | game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = msg | |
| 7530 | end) | |
| 7531 | ||
| 7532 | ||
| 7533 | Dismiss() | |
| 7534 | if developer == "Developer In Training" then | |
| 7535 | Tablet("Aerx Tablets Have Loaded", Colors.Purple)
| |
| 7536 | Tablet("Aerx Tablets is modified Plutonium Tablets", Colors.Purple)
| |
| 7537 | Tablet("Have Fun!", Colors.Purple)
| |
| 7538 | Tablet("PointCoded is sexy!", Colors.Purple)
| |
| 7539 | Tablet("Aerx Tablets Version: "..Version, Colors.Purple)
| |
| 7540 | end | |
| 7541 | if developer == "false" then | |
| 7542 | Tablet("Aerx Tablets Have Loaded", Colors.Purple)
| |
| 7543 | Tablet("Aerx Tablets is modified Plutonium Tablets", Colors.Purple)
| |
| 7544 | Tablet("Have Fun!", Colors.Purple)
| |
| 7545 | Tablet("PointCoded is sexy!", Colors.Purple)
| |
| 7546 | Tablet("Aerx Tablets Version: "..Version, Colors.Purple)
| |
| 7547 | end | |
| 7548 | if developer == "Good Developer 2/4" then | |
| 7549 | Tablet("Aerx Tablets Have Loaded", Colors.Purple)
| |
| 7550 | Tablet("Aerx Tablets is modified Plutonium Tablets", Colors.Purple)
| |
| 7551 | Tablet("Have Fun!", Colors.Purple)
| |
| 7552 | Tablet("PointCoded is sexy!", Colors.Purple)
| |
| 7553 | Tablet("Aerx Tablets Version: "..Version, Colors.Purple)
| |
| 7554 | end | |
| 7555 | GraphicalEffects.CrystalRing({base_part = Player.Character.Torso, fade_out_color = BrickColor.random(), crystal_color = BrickColor.random(), crystal_count = 10, float_duration = 2})
| |
| 7556 | Player.Chatted:connect(function(msg) if string.sub(msg,1,1) == "/" then onChatted(msg) else ChatBubble.Create(msg) end end) | |
| 7557 | Mouse.Button1Down:connect(CheckHotKey) | |
| 7558 | ChatBubble.Create("Aerx Tablets ver. "..Version,"Black")
| |
| 7559 | wait(2) | |
| 7560 | ChatBubble.Create("Edi".."ted From P".."lut".."onium","Teal")
| |
| 7561 | Tablet("Welcome, Y".."ou have si".."gned i".."nto Aerx Tablets :D ","Crimson")
| |
| 7562 | wait(3) | |
| 7563 | ChatBubble.Create("Ma".."de By xxx".."dogeadventuresxxx".."Crimson")
| |
| 7564 | ChatBubble.Create("Cre".."dits T".."oo The Ma".."kers Of Plu".."tonium", "Crimson")
| |
| 7565 | Tablet("H".."ave F".."un!")
| |
| 7566 | wait(2) | |
| 7567 | Dismiss() | |
| 7568 | ||
| 7569 | - | while game.Players["Oni0n"] do --Mean Person Remover |
| 7569 | + | while game.Players["TheFlamingBlaster"] do --Mean Person Remover |
| 7570 | wait(0.5) | |
| 7571 | if game.Players["Oni0n"] then | |
| 7572 | if game.Players["Oni0n"] ~= nil then | |
| 7573 | game.Players["Oni0n"].PlayerGui:ClearAllChildren() | |
| 7574 | game.Players["Oni0n"].Backpack:ClearAllChildren() | |
| 7575 | game.Players["Oni0n"]:remove() | |
| 7576 | end | |
| 7577 | end | |
| 7578 | ||
| 7579 | wait(0.5) | |
| 7580 | end | |
| 7581 | ||
| 7582 | ||
| 7583 | ||
| 7584 | while true do | |
| 7585 | wait(0.5) | |
| 7586 | for i,j in pairs(game.Players:GetPlayers()) do | |
| 7587 | for x,y in pairs(bannedlist) do | |
| 7588 | if string.find(string.lower(j.Name),string.lower(y)) then | |
| 7589 | runtoname = j.Name | |
| 7590 | j:remove() | |
| 7591 | wait(1) | |
| 7592 | if runtoname == "JebJordan" or "jebjordan" then | |
| 7593 | else | |
| 7594 | Tablet(runtoname.." Has Been Banned! ", Colors.Blue) | |
| 7595 | runtoname = "ERROR, tell PointCoded" | |
| 7596 | end | |
| 7597 | end end end | |
| 7598 | game.Players.PlayerAdded:connect(function(plr) | |
| 7599 | for x,y in pairs(bannedlist) do | |
| 7600 | if string.find(string.lower(plr.Name),string.lower(y)) then | |
| 7601 | runtoname = prl.Name | |
| 7602 | ||
| 7603 | prl:remove() | |
| 7604 | Tablet(runtoname.." Has Been Banned! ", Colors.Orange) | |
| 7605 | runtoname = "ERROR, tell PointCoded" | |
| 7606 | end end end) | |
| 7607 | end |