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