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