From 67e8f51ca4163088a9dac103ff4d72e52cf30ed3 Mon Sep 17 00:00:00 2001 From: Lewin Kelly Date: Sun, 24 Mar 2024 18:23:13 +0000 Subject: [PATCH] Corescript improvements, playerlist fixes, and improvements to debug console --- 38037265.xml | 8 +- Libraries/Fusion/Animation/Spring.luau | 2 +- Libraries/Fusion/State/Computed.luau | 2 +- Libraries/Fusion/State/ForKeys.luau | 2 +- Libraries/Fusion/State/ForPairs.luau | 2 +- Libraries/Fusion/State/ForValues.luau | 2 +- Libraries/Fusion/State/Observer.luau | 2 +- Libraries/Fusion/State/Value.luau | 2 +- Libraries/Fusion/Utility/Contextual.luau | 1 - Libraries/Load.luau | 1 + Libraries/Red/Net/Event.luau | 2 + Libraries/Red/Net/Serdes.luau | 2 + Libraries/Red/Net/init.luau | 2 + Libraries/Red/RedEvent.luau | 2 + Libraries/Red/Util/Bin.luau | 2 + Libraries/Red/Util/Clock.luau | 3 +- Libraries/Red/Util/Collection.luau | 2 + Libraries/Red/Util/Promise.luau | 2 + Libraries/Red/Util/Ratelimit.luau | 2 + Libraries/Red/Util/Signal.luau | 2 + Libraries/Red/Util/Spawn.luau | 4 +- Libraries/Red/init.luau | 2 + Libraries/Red/typeof.luau | 181 -- Modules/DebugConsole.luau | 231 ++- Modules/Logger.luau | 15 + Modules/Polyfill/typeof.luau | 94 +- defs.d.lua | 20 +- luau/107893730.luau | 9 +- luau/36868950.luau | 8 +- luau/37801172.luau | 31 +- luau/39250920.luau | 35 +- luau/45284430.luau | 287 ++-- luau/46295863.luau | 1948 +++++++++++----------- luau/48488235.luau | 164 +- luau/53878047.luau | 11 +- luau/53878057.luau | 13 +- luau/60595695.luau | 4 +- luau/97188756.luau | 37 +- luau/host.luau | 2 +- luau/join.luau | 1 + terrain plugins/00 - terrain.luau | 2 +- terrain plugins/01 - builder.luau | 2 +- terrain plugins/02 - remover.luau | 2 +- terrain plugins/03 - elevation.luau | 6 +- terrain plugins/04 - brush.luau | 2 +- terrain plugins/06 - craters.luau | 6 +- terrain plugins/08 - roads.luau | 2 +- terrain plugins/09 - materialpaint.luau | 2 +- terrain plugins/10 - stamper.luau | 2 +- terrain plugins/11 - floodfill.luau | 2 +- 50 files changed, 1559 insertions(+), 1611 deletions(-) delete mode 100644 Libraries/Red/typeof.luau create mode 100644 Modules/Logger.luau diff --git a/38037265.xml b/38037265.xml index 400d24d..09013d8 100644 --- a/38037265.xml +++ b/38037265.xml @@ -136,7 +136,7 @@ function AnimateBars(x, y, lastX, height) end tray.bar2.BackgroundColor3 = Color3.new(1, GBchannels, GBchannels) - wait(0.02) + wait() end end @@ -159,12 +159,12 @@ function AnimateHurtOverlay() for i=1,i_total do overlay.Position = UDim2.new( (-2 + (2 * (i/i_total)) + wiggle_total/2), 0, (-2 + (2 * (i/i_total)) + wiggle_total/2), -22 ) overlay.Size = UDim2.new( (4.5 - (3.5 * (i/i_total)) + wiggle_total), 0, (4.65 - (3.5 * (i/i_total)) + wiggle_total), 30 ) - wait(0.01) + wait() end i_total = 30 - wait(0.03) + wait() -- Animate Out, slow for i=1,i_total do @@ -174,7 +174,7 @@ function AnimateHurtOverlay() wiggle_total = wiggle_total + wiggle_i overlay.Position = UDim2.new( (0 - (2 * (i/i_total)) + wiggle_total/2), 0, (0 - (2 * (i/i_total)) + wiggle_total/2), -22 ) overlay.Size = UDim2.new( (1 + (3.5 * (i/i_total)) + wiggle_total), 0, (1.15 + (3.5 * (i/i_total)) + wiggle_total), 30 ) - wait(0.01) + wait() end -- Hide after we're done diff --git a/Libraries/Fusion/Animation/Spring.luau b/Libraries/Fusion/Animation/Spring.luau index e11a5c8..a1ca43b 100644 --- a/Libraries/Fusion/Animation/Spring.luau +++ b/Libraries/Fusion/Animation/Spring.luau @@ -1,4 +1,4 @@ ---!nonstrict +--!strict --[[ Constructs a new computed state object, which follows the value of another diff --git a/Libraries/Fusion/State/Computed.luau b/Libraries/Fusion/State/Computed.luau index ced3fd6..395993a 100644 --- a/Libraries/Fusion/State/Computed.luau +++ b/Libraries/Fusion/State/Computed.luau @@ -1,4 +1,4 @@ ---!nonstrict +--!strict --[[ Constructs and returns objects which can be used to model derived reactive diff --git a/Libraries/Fusion/State/ForKeys.luau b/Libraries/Fusion/State/ForKeys.luau index 98087d6..378503f 100644 --- a/Libraries/Fusion/State/ForKeys.luau +++ b/Libraries/Fusion/State/ForKeys.luau @@ -1,4 +1,4 @@ ---!nonstrict +--!strict --[[ Constructs a new ForKeys state object which maps keys of an array using diff --git a/Libraries/Fusion/State/ForPairs.luau b/Libraries/Fusion/State/ForPairs.luau index 03ef607..4642544 100644 --- a/Libraries/Fusion/State/ForPairs.luau +++ b/Libraries/Fusion/State/ForPairs.luau @@ -1,4 +1,4 @@ ---!nonstrict +--!strict --[[ Constructs a new ForPairs object which maps pairs of a table using diff --git a/Libraries/Fusion/State/ForValues.luau b/Libraries/Fusion/State/ForValues.luau index 036101c..7e30d1a 100644 --- a/Libraries/Fusion/State/ForValues.luau +++ b/Libraries/Fusion/State/ForValues.luau @@ -1,4 +1,4 @@ ---!nonstrict +--!strict --[[ Constructs a new ForValues object which maps values of a table using diff --git a/Libraries/Fusion/State/Observer.luau b/Libraries/Fusion/State/Observer.luau index f457be2..0f3ae17 100644 --- a/Libraries/Fusion/State/Observer.luau +++ b/Libraries/Fusion/State/Observer.luau @@ -1,4 +1,4 @@ ---!nonstrict +--!strict --[[ Constructs a new state object which can listen for updates on another state diff --git a/Libraries/Fusion/State/Value.luau b/Libraries/Fusion/State/Value.luau index 01da6b1..1189098 100644 --- a/Libraries/Fusion/State/Value.luau +++ b/Libraries/Fusion/State/Value.luau @@ -1,4 +1,4 @@ ---!nonstrict +--!strict --[[ Constructs and returns objects which can be used to model independent diff --git a/Libraries/Fusion/Utility/Contextual.luau b/Libraries/Fusion/Utility/Contextual.luau index 193df50..a991647 100644 --- a/Libraries/Fusion/Utility/Contextual.luau +++ b/Libraries/Fusion/Utility/Contextual.luau @@ -1,5 +1,4 @@ --!strict ---!nolint LocalShadow --[[ Time-based contextual values, to allow for transparently passing values down diff --git a/Libraries/Load.luau b/Libraries/Load.luau index 90aaf35..30c224d 100644 --- a/Libraries/Load.luau +++ b/Libraries/Load.luau @@ -1,3 +1,4 @@ +--!strict local Load = {} function Load.Help() diff --git a/Libraries/Red/Net/Event.luau b/Libraries/Red/Net/Event.luau index c23d23d..bc325ea 100644 --- a/Libraries/Red/Net/Event.luau +++ b/Libraries/Red/Net/Event.luau @@ -1,3 +1,5 @@ +--!strict + return function(IsServer: boolean) local RunService = game:GetService "RunService" diff --git a/Libraries/Red/Net/Serdes.luau b/Libraries/Red/Net/Serdes.luau index 1cdcb48..bc7c9c9 100644 --- a/Libraries/Red/Net/Serdes.luau +++ b/Libraries/Red/Net/Serdes.luau @@ -1,3 +1,5 @@ +--!strict + return function(IsServer: boolean) local RedEvent = require "../RedEvent"(IsServer) local Event = RedEvent.Remote diff --git a/Libraries/Red/Net/init.luau b/Libraries/Red/Net/init.luau index d6dd261..017163e 100644 --- a/Libraries/Red/Net/init.luau +++ b/Libraries/Red/Net/init.luau @@ -1,3 +1,5 @@ +--!strict + return function(IsServer: boolean) local Players = game:GetService "Players" diff --git a/Libraries/Red/RedEvent.luau b/Libraries/Red/RedEvent.luau index 197fc24..620f661 100644 --- a/Libraries/Red/RedEvent.luau +++ b/Libraries/Red/RedEvent.luau @@ -1,3 +1,5 @@ +--!strict + return function(IsServer: boolean) local ReplicatedStorage = game:GetService "ReplicatedStorage" local Players = game:GetService "Players" diff --git a/Libraries/Red/Util/Bin.luau b/Libraries/Red/Util/Bin.luau index d950fe1..b4cfccf 100644 --- a/Libraries/Red/Util/Bin.luau +++ b/Libraries/Red/Util/Bin.luau @@ -1,3 +1,5 @@ +--!strict + local Spawn = require "./Spawn" local typeof = require "../../../Modules/Polyfill/typeof" diff --git a/Libraries/Red/Util/Clock.luau b/Libraries/Red/Util/Clock.luau index c01c1dc..4c4c411 100644 --- a/Libraries/Red/Util/Clock.luau +++ b/Libraries/Red/Util/Clock.luau @@ -1,4 +1,5 @@ --- local ReplicatedStorage = game:GetService "ReplicatedStorage" +--!strict + local RunService = game:GetService "RunService" local function MakeHeartbeatFunction(Clock: Clock) diff --git a/Libraries/Red/Util/Collection.luau b/Libraries/Red/Util/Collection.luau index f1b6ac9..0ccb6c2 100644 --- a/Libraries/Red/Util/Collection.luau +++ b/Libraries/Red/Util/Collection.luau @@ -1,3 +1,5 @@ +--!strict + local CollectionService = game:GetService "CollectionService" local Spawn = require "./Spawn" diff --git a/Libraries/Red/Util/Promise.luau b/Libraries/Red/Util/Promise.luau index 69804b0..fafefad 100644 --- a/Libraries/Red/Util/Promise.luau +++ b/Libraries/Red/Util/Promise.luau @@ -1,3 +1,5 @@ +--!strict + local RunService = game:GetService "RunService" local Spawn = require "./Spawn" diff --git a/Libraries/Red/Util/Ratelimit.luau b/Libraries/Red/Util/Ratelimit.luau index 7435f2c..23b9014 100644 --- a/Libraries/Red/Util/Ratelimit.luau +++ b/Libraries/Red/Util/Ratelimit.luau @@ -1,3 +1,5 @@ +--!strict + return function(Limit: number, Interval: number) assert(Limit > 0, "Limit must be greater than 0") diff --git a/Libraries/Red/Util/Signal.luau b/Libraries/Red/Util/Signal.luau index 6da6de1..b42d5ff 100644 --- a/Libraries/Red/Util/Signal.luau +++ b/Libraries/Red/Util/Signal.luau @@ -1,3 +1,5 @@ +--!strict + local Promise = require "./Promise" local Spawn = require "./Spawn" diff --git a/Libraries/Red/Util/Spawn.luau b/Libraries/Red/Util/Spawn.luau index 1dc1317..c702397 100644 --- a/Libraries/Red/Util/Spawn.luau +++ b/Libraries/Red/Util/Spawn.luau @@ -1,4 +1,6 @@ -local FreeThread: thread? = nil +--!strict + +local FreeThread: thread? local function FunctionPasser(fn, ...) local AquiredThread = FreeThread diff --git a/Libraries/Red/init.luau b/Libraries/Red/init.luau index 92143c7..2526cb4 100644 --- a/Libraries/Red/init.luau +++ b/Libraries/Red/init.luau @@ -1,3 +1,5 @@ +--!strict + local function Red(_, Script: LuaSourceContainer) local _SERVER diff --git a/Libraries/Red/typeof.luau b/Libraries/Red/typeof.luau deleted file mode 100644 index 170ab2c..0000000 --- a/Libraries/Red/typeof.luau +++ /dev/null @@ -1,181 +0,0 @@ --- A basic polyfill for the typeof function - -return function(value) - local basicType = type(value) - - if - basicType == "nil" - or basicType == "boolean" - or basicType == "number" - or basicType == "string" - or basicType == "function" - or basicType == "thread" - or basicType == "table" - then - return basicType - end - - -- Will short-circuit - --[[ - { - name of type to check, - { list of required properties }, - } - ]] - local tests = { - { - "Instance", - { "ClassName" }, - }, - { - "EnumItem", - { "EnumType", "Name", "Value" }, - }, - { - "Enum", - { "GetEnumItems" }, - }, - { - "Enums", - { "MembershipType" }, -- lmao - }, - { - "RBXScriptSignal", - { - "connect", - -- "connected", - -- "connectFirst", - -- "connectLast", - "wait", - }, - }, - { - "RBXScriptConnection", - { - "connected", - "disconnect", - }, - }, - { - "TweenInfo", - { - "EasingDirection", - -- "Time", - -- "DelayTime", - "RepeatCount", - "EasingStyle", - -- "Reverses", - }, - }, - { - "CFrame", - { - "p", - "x", - "y", - "z", - "lookVector", - }, - }, - { - "Vector3", - { - "Lerp", - -- "Cross", - -- "Dot", - "unit", - "magnitude", - "x", - "y", - "z", - }, - }, - { - "Vector3int16", - { "z", "x", "y" }, - }, - { - "Vector2", - { "unit", "magnitude", "x", "y" }, - }, - { - "Vector2int16", - { "x", "y" }, - }, - { - "Region3", - { "CFrame", "Size" }, - }, - { - "Region3int16", - { "Min", "Max" }, - }, - { - "Ray", - { - "Origin", - "Direction", - "Unit", - "ClosestPoint", - "Distance", - }, - }, - { - "UDim", - { "Scale", "Offset" }, - }, - { - "Axes", - { "Z", "X", "Y" }, - }, - { - "UDim2", - { "X", "Y" }, - }, - { - "BrickColor", - { - "Number", - "Name", - "Color", - "r", - "g", - "b", - }, - }, - { - "Color3", - { "r", "g", "b" }, - }, - { - "Faces", - { - "Right", - "Top", - "Back", - -- "Left", - -- "Bottom", - -- "Front", - }, - }, - } - - for _, v in ipairs(tests) do - local t, test = v[1], v[2] - - local ok, result = pcall(function() - for _, prop in ipairs(test) do - if value[prop] == nil then - return false - end - -- Cannot throw if the property does not exist, - -- as userdatas may allow nil indexing - end - return true - end) - - if ok and result then - return t - end - end -end diff --git a/Modules/DebugConsole.luau b/Modules/DebugConsole.luau index b301ef8..df8b4f8 100644 --- a/Modules/DebugConsole.luau +++ b/Modules/DebugConsole.luau @@ -1,17 +1,71 @@ +--!strict + local Players = game:GetService "Players" +local MaxLength = 35 local New = (require "../Modules/New").New -return function(parent: Instance) - local username = Players.LocalPlayer.Name - if username ~= "Heliodex" then -- Don't show the debug console for anyone but me +local logEvent: BindableEvent + +local docs: { [string]: { string } } = { + help = { + "help()", + "You've already found this command!", + }, + printTable = { + "printTable(t: { [any]: any }, max: number?)", + "Prints the contents of a table to the console.", + "`max` is the maximum number of entries to print. If not provided, all", + "entries are printed.", + }, + exit = { + "exit()", + "Exits the debug console.", + }, +} + +local utility = { + help = function() + for _, doc in pairs(docs) do + logEvent:Fire(doc[1], Color3.new(1, 1, 0.3)) + for i = 2, #doc do + logEvent:Fire("\t" .. doc[i], Color3.new(1, 1, 1)) + end + end + end, + printTable = function(t: { [any]: any }, max: number?) + assert(type(t) == "table", "Expected table, got " .. type(t)) + + local num = max or math.huge + local len = 0 + for k, v in pairs(t) do + len += 1 + if len < num then + logEvent:Fire(tostring(k) .. " = " .. tostring(v)) + end + end + if len >= num then + logEvent:Fire("... and " .. tostring(len - num) .. " more") + end + end, + exit = function() + logEvent:Fire("Goodbye!", Color3.new(1, 1, 0.3)) + wait(0.5) + local debug = game.CoreGui:FindFirstChild "Debug console" :: ScreenGui + debug:Destroy() + end, +} + +return function(parent: CoreGui) + if not Players.LocalPlayer or Players.LocalPlayer.Name ~= "Heliodex" then -- Don't show the debug console for anyone but me return end - local logEvent = New "BindableEvent" { - Name = "Log", - Parent = parent, - } + logEvent = logEvent + or New "BindableEvent" { + Name = "Log", + Parent = game, + } local screen = New "ScreenGui" { Name = "Debug console", @@ -21,34 +75,159 @@ return function(parent: Instance) local frame = New "Frame" { Name = "Frame", BackgroundTransparency = 1, - Position = UDim2.new(0, 0, 0, 0), - Size = UDim2.new(0.5, 0, 1, 0), - Parent = screen - New "TextBox" { - Name = "Input", - BackgroundColor3 = Color3.new(0, 0, 0), - BackgroundTransparency = 0.5, - BorderSizePixel = 0, - Position = UDim2.new(0, 0, 1, -30), - Size = UDim2.new(1, 0, 0, 30), - Font = Enum.Font.SourceSans, - FontSize = Enum.FontSize.Size14, - TextColor3 = Color3.new(1, 1, 1), - TextXAlignment = Enum.TextXAlignment.Left, - }, + Position = UDim2.new(0, 0, 0.2, 0), + Size = UDim2.new(0.25, 0, 0.7, 0), + Parent = screen, } - local console = New "TextBox" { + local console = New "Frame" { Name = "Console", BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 0.5, BorderSizePixel = 0, + Position = UDim2.new(0, 0, 0, 0), + Size = UDim2.new(1, 0, 1, -30), + Parent = frame, + } + + local logLines = {} + local logLineInstances: { TextLabel } = {} + for i = 1, MaxLength do + table.insert(logLines, { + Text = "", + Colour = Color3.new(1, 1, 1), + }) + table.insert( + logLineInstances, + New "TextLabel" { + Name = "LogLine", + BackgroundTransparency = 1, + Font = Enum.Font.SourceSans, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0, 0, 0, (i - 1) * 18), + Size = UDim2.new(1, 0, 0, 18), + Text = "", + TextColor3 = Color3.new(1, 1, 1), + TextXAlignment = Enum.TextXAlignment.Left, + Parent = console, + } + ) + end + + local function recomputeLogLines() + for i, line in ipairs(logLines) do + logLineInstances[i].Text = line.Text + logLineInstances[i].TextColor3 = line.Colour or Color3.new(1, 1, 1) + end + end + + logEvent.Event:connect(function(text: string, colour: Color3?) + table.insert(logLines, { + Text = text, + Colour = colour or Color3.new(1, 1, 1), + }) + if #logLines > MaxLength then + table.remove(logLines, 1) + end + + recomputeLogLines() + end) + + local input = New "TextBox" { + Name = "Input", + BackgroundColor3 = Color3.new(0.2, 0.2, 0.2), + BackgroundTransparency = 0.2, + BorderSizePixel = 0, Position = UDim2.new(0, 0, 1, -30), - Size = UDim2.new(1, 0, 0, 30), + Size = UDim2.new(1, -30, 0, 30), Font = Enum.Font.SourceSans, - FontSize = Enum.FontSize.Size14, + FontSize = Enum.FontSize.Size18, + Text = "", TextColor3 = Color3.new(1, 1, 1), TextXAlignment = Enum.TextXAlignment.Left, - Parent = frame + ClearTextOnFocus = false, + Parent = frame, } + + local upButton = New "TextButton" { + Name = "UpButton", + BackgroundColor3 = Color3.new(0.2, 0.2, 0.2), + BackgroundTransparency = 0.2, + BorderSizePixel = 0, + Position = UDim2.new(1, -30, 1, -30), + Size = UDim2.new(0, 30, 0, 30), + Font = Enum.Font.SourceSans, + FontSize = Enum.FontSize.Size24, + Text = "^", + TextColor3 = Color3.new(1, 1, 1), + Parent = frame, + } + + local history = {} + local historyPos = 1 + + -- on upButton pressed, go back in history + upButton.MouseButton1Click:connect(function() + if historyPos > #history then + return + end + + input.Text = history[historyPos] + historyPos += 1 + end) + + input.FocusLost:connect(function(enterPressed) + if enterPressed then + historyPos = 1 + local text = input.Text + table.insert(history, 1, text) + logEvent:Fire("> " .. text) + + -- run the command + local fn = loadstring(text) + + if fn then + local env = getfenv(fn) + for k, v in pairs(utility) do + env[k] = v + end + setfenv(fn, env) + + local success, output = ypcall(fn) + if success then + logEvent:Fire( + "= " .. tostring(output), + Color3.new(0.5, 1, 0.5) + ) + else + logEvent:Fire( + "! " .. tostring(output), + Color3.new(1, 0.5, 0.5) + ) + end + else + logEvent:Fire("Invalid command", Color3.new(1, 0.3, 0.3)) + end + + input.Text = "" + input.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2) + end + end) + + input.Changed:connect(function(property) + if property ~= "Text" or input.Text == "" then + return + end + + input.BackgroundColor3 = Color3.new(0, 0, 0) + end) + + logEvent:Fire("[Reading access...]", Color3.new(0.5, 0.5, 0.5)) -- haxor text + logEvent:Fire("[Access granted.]", Color3.new(0.5, 1, 0.5)) + logEvent:Fire( + "Welcome to the Mercury Debug Console!", + Color3.new(1, 1, 0.3) + ) + logEvent:Fire("Type `help()` for a list of commands.", Color3.new(1, 1, 1)) + logEvent:Fire("") end diff --git a/Modules/Logger.luau b/Modules/Logger.luau new file mode 100644 index 0000000..1ef6b9d --- /dev/null +++ b/Modules/Logger.luau @@ -0,0 +1,15 @@ +local logEvent + +return function(...: string) + if game.Players.LocalPlayer.Name ~= "Heliodex" then + return + end + + logEvent = logEvent or game:WaitForChild "Log" + local message = "" + for _, v in ipairs { ... } do + message ..= tostring(v) .. " " + end + print(message) + logEvent:Fire(message) +end diff --git a/Modules/Polyfill/typeof.luau b/Modules/Polyfill/typeof.luau index faa9f2b..68a04fa 100644 --- a/Modules/Polyfill/typeof.luau +++ b/Modules/Polyfill/typeof.luau @@ -1,3 +1,4 @@ +--!strict -- A basic polyfill for the typeof function return function(value) @@ -16,32 +17,26 @@ return function(value) end -- Will short-circuit - --[[ - { - name of type to check, - { list of required properties }, - } - ]] local tests = { { - "Instance", - { "ClassName" }, + Type = "Instance", + Props = { "ClassName" }, }, { - "EnumItem", - { "EnumType", "Name", "Value" }, + Type = "EnumItem", + Props = { "EnumType", "Name", "Value" }, }, { - "Enum", - { "GetEnumItems" }, + Type = "Enum", + Props = { "GetEnumItems" }, }, { - "Enums", - { "MembershipType" }, -- lmao + Type = "Enums", + Props = { "MembershipType" }, -- lmao }, { - "RBXScriptSignal", - { + Type = "RBXScriptSignal", + Props = { "connect", -- "connected", -- "connectFirst", @@ -50,15 +45,15 @@ return function(value) }, }, { - "RBXScriptConnection", - { + Type = "RBXScriptConnection", + Props = { "connected", "disconnect", }, }, { - "TweenInfo", - { + Type = "TweenInfo", + Props = { "EasingDirection", -- "Time", -- "DelayTime", @@ -68,8 +63,8 @@ return function(value) }, }, { - "CFrame", - { + Type = "CFrame", + Props = { "p", "x", "y", @@ -78,8 +73,8 @@ return function(value) }, }, { - "Vector3", - { + Type = "Vector3", + Props = { "Lerp", -- "Cross", -- "Dot", @@ -91,28 +86,28 @@ return function(value) }, }, { - "Vector3int16", - { "z", "x", "y" }, + Type = "Vector3int16", + Props = { "z", "x", "y" }, }, { - "Vector2", - { "unit", "magnitude", "x", "y" }, + Type = "Vector2", + Props = { "unit", "magnitude", "x", "y" }, }, { - "Vector2int16", - { "x", "y" }, + Type = "Vector2int16", + Props = { "x", "y" }, }, { - "Region3", - { "CFrame", "Size" }, + Type = "Region3", + Props = { "CFrame", "Size" }, }, { - "Region3int16", - { "Min", "Max" }, + Type = "Region3int16", + Props = { "Min", "Max" }, }, { - "Ray", - { + Type = "Ray", + Props = { "Origin", "Direction", "Unit", @@ -121,20 +116,20 @@ return function(value) }, }, { - "UDim", - { "Scale", "Offset" }, + Type = "UDim", + Props = { "Scale", "Offset" }, }, { - "Axes", - { "Z", "X", "Y" }, + Type = "Axes", + Props = { "Z", "X", "Y" }, }, { - "UDim2", - { "X", "Y" }, + Type = "UDim2", + Props = { "X", "Y" }, }, { - "BrickColor", - { + Type = "BrickColor", + Props = { "Number", "Name", "Color", @@ -144,12 +139,12 @@ return function(value) }, }, { - "Color3", - { "r", "g", "b" }, + Type = "Color3", + Props = { "r", "g", "b" }, }, { - "Faces", - { + Type = "Faces", + Props = { "Right", "Top", "Back", @@ -161,7 +156,7 @@ return function(value) } for _, v in ipairs(tests) do - local t, test = v[1], v[2] + local t, test = v.Type, v.Props local ok, result = pcall(function() for _, prop in ipairs(test) do @@ -178,5 +173,6 @@ return function(value) return t end end + return basicType end diff --git a/defs.d.lua b/defs.d.lua index c6e47d6..3cb1e5a 100644 --- a/defs.d.lua +++ b/defs.d.lua @@ -4024,19 +4024,9 @@ declare class ClusterPacketCache extends Instance end declare class CollectionService extends Instance - TagAdded: RBXScriptSignal - ItemAdded: RBXScriptSignal - TagRemoved: RBXScriptSignal - ItemRemoved: RBXScriptSignal - function AddTag(self, instance: Instance, tag: string): nil - function GetAllTags(self): { string } - function GetInstanceAddedSignal(self, tag: string): RBXScriptSignal - function GetInstanceRemovedSignal(self, tag: string): RBXScriptSignal + ItemAdded: RBXScriptSignal + ItemRemoved: RBXScriptSignal function GetCollection(self, tag: string): { Instance } - function GetTagged(self, tag: string): { Instance } - function GetTags(self, instance: Instance): { string } - function HasTag(self, instance: Instance, tag: string): boolean - function RemoveTag(self, instance: Instance, tag: string): nil end declare class CommandInstance extends Instance @@ -5037,12 +5027,8 @@ end declare class TextBox extends GuiObject ClearTextOnFocus: boolean - ContentText: string - CursorPosition: number FocusLost: RBXScriptSignal - Focused: RBXScriptSignal<> Font: EnumFont - FontFace: Font LineHeight: number ManualFocusRelease: boolean MaxVisibleGraphemes: number @@ -9142,4 +9128,4 @@ declare LoadLibrary: ((libraryName: "RbxFusion") -> Fusion) & ((libraryName: "Rb declare function settings(): GlobalSettings declare function UserSettings(): UserSettings declare function PluginManager(): PluginManager -declare function ypcall(f: (() -> any) | (() -> ()), ...: any): (boolean, any) +declare function ypcall(f: (() -> any) | (() -> ()) | ((...any) -> (), (...any) -> ()) -> (), ...: any): (boolean, any) diff --git a/luau/107893730.luau b/luau/107893730.luau index 7004817..888e9cc 100644 --- a/luau/107893730.luau +++ b/luau/107893730.luau @@ -8,20 +8,21 @@ local MarketplaceService = game:GetService "MarketplaceService" local GuiService = game:GetService "GuiService" local ContentProvider = game:GetService "ContentProvider" local HttpService = game:GetService "HttpService" +local RunService = game:GetService "RunService" -- wait for important items to appear while not Game do - wait(0.1) + RunService.Heartbeat:wait() end while not MarketplaceService do - wait(0.1) + RunService.Heartbeat:wait() MarketplaceService = game:GetService "MarketplaceService" end while not game:FindFirstChild "CoreGui" do - wait(0.1) + RunService.Heartbeat:wait() end while not game.CoreGui:FindFirstChild "RobloxGui" do - wait(0.1) + RunService.Heartbeat:wait() end -------------------------------- Global Variables ---------------------------------------- diff --git a/luau/36868950.luau b/luau/36868950.luau index dc4f8ad..5c49f32 100644 --- a/luau/36868950.luau +++ b/luau/36868950.luau @@ -1,3 +1,4 @@ +--!strict -- CoreGui.RobloxGui.CoreScripts/ToolTip print "[Mercury]: Loaded corescript 36868950" @@ -5,7 +6,10 @@ local News = require "../Modules/New" local New = News.New local Hydrate = News.Hydrate -local controlFrame = script.Parent:FindFirstChild "ControlFrame" +local RunService = game:GetService "RunService" + +local RobloxGui = script.Parent +local controlFrame = RobloxGui:FindFirstChild "ControlFrame" if not controlFrame then return @@ -49,7 +53,7 @@ local function setUpListeners(frameToListen) - fadeSpeed frameToListen.TextTransparency = frameToListen.TextTransparency - fadeSpeed - wait() + RunService.Heartbeat:wait() end end end diff --git a/luau/37801172.luau b/luau/37801172.luau index 005dc68..5fda8a5 100644 --- a/luau/37801172.luau +++ b/luau/37801172.luau @@ -5,7 +5,8 @@ print "[Mercury]: Loaded corescript 37801172" local ScriptContext = game:GetService "ScriptContext" local CoreGui = game:GetService "CoreGui" -require "../Modules/DebugConsole"(CoreGui) +local Debug = require "../Modules/DebugConsole" +Debug(CoreGui) -- Creates all neccessary scripts for the gui on initial load, everything except build tools -- Please note that these are loaded in a specific order to diminish errors/perceived load time by user @@ -24,7 +25,10 @@ local function waitForChild(instance, name) end waitForChild(CoreGui, "RobloxGui") -local screenGui = CoreGui:FindFirstChild "RobloxGui" +local screenGui = CoreGui:FindFirstChild "RobloxGui" :: ScreenGui & { + Backpack: Frame, + CurrentLoadout: Frame, +} local scripts = { [36868950] = "CoreScripts/ToolTip", -- ToolTipper (creates tool tips for gui) @@ -40,25 +44,8 @@ for id, path in pairs(scripts) do ScriptContext:AddCoreScript(id, screenGui, path) end -if screenGui.AbsoluteSize.Y >= 600 then - -- New Player List - ScriptContext:AddCoreScript( - 48488235, - screenGui, - "CoreScripts/PlayerListScript" - ) -else - delay(5, function() - if screenGui.AbsoluteSize.Y >= 600 then - -- New Player List - ScriptContext:AddCoreScript( - 48488235, - screenGui, - "CoreScripts/PlayerListScript" - ) - end - end) -end +-- New Player List +ScriptContext:AddCoreScript(48488235, screenGui, "CoreScripts/PlayerListScript") -- Backpack Builder, creates most of the backpack gui ScriptContext:AddCoreScript( @@ -69,7 +56,7 @@ ScriptContext:AddCoreScript( waitForChild(screenGui, "CurrentLoadout") waitForChild(screenGui, "Backpack") -local Backpack = screenGui.Backpack +local Backpack = screenGui.Backpack :: Frame -- Manager handles all big backpack state changes, other scripts subscribe to this and do things accordingly ScriptContext:AddCoreScript( diff --git a/luau/39250920.luau b/luau/39250920.luau index 3f30c0b..4379041 100644 --- a/luau/39250920.luau +++ b/luau/39250920.luau @@ -1,3 +1,4 @@ +--!strict -- CoreGui.RobloxGui.CoreScripts/MainBotChatScript print "[Mercury]: Loaded corescript 39250920" @@ -6,6 +7,7 @@ local New = News.New local Hydrate = News.Hydrate local InsertService = game:GetService "InsertService" +local RunService = game:GetService "RunService" local function waitForProperty(instance, name) while not instance[name] do @@ -173,11 +175,13 @@ local function createMessageDialog() } end -local function showMessage(msg, size) +local function showMessage(msg: string, size: number) + Hydrate(messageDialog) { + Size = UDim2.new(0, size, 0, 40), + Position = UDim2.new(0.5, -size / 2, 0.5, -40), + Visible = true, + } messageDialog.Text.Text = msg - messageDialog.Size = UDim2.new(0, size, 0, 40) - messageDialog.Position = UDim2.new(0.5, -size / 2, 0.5, -40) - messageDialog.Visible = true wait(2) messageDialog.Visible = false end @@ -243,7 +247,7 @@ local function normalEndDialog() endDialog() end -local function sanitizeMessage(msg) +local function sanitiseMessage(msg) if string.len(msg) == 0 then return "..." end @@ -256,7 +260,7 @@ local function presentDialogChoices(talkingPart, dialogChoices) end currentConversationPartner = talkingPart - local sortedDialogChoices = {} + local sortedDialogChoices: { DialogChoice } = {} for _, obj in pairs(dialogChoices) do if obj:IsA "DialogChoice" then table.insert(sortedDialogChoices, obj) @@ -313,7 +317,6 @@ local function renewKillswitch(dialog) end currentAbortDialogScript = Hydrate(timeoutScript:Clone()) { - archivable = false, Disabled = false, Parent = dialog, @@ -323,11 +326,13 @@ end local function selectChoice(choice) renewKillswitch(currentConversationDialog) + local localPlayer = game.Players.LocalPlayer + --First hide the Gui mainFrame.Visible = false if choice == lastChoice then game.Chat:Chat( - game.Players.LocalPlayer.Character, + localPlayer.Character, "Goodbye!", getChatColor(currentTone()) ) @@ -337,8 +342,8 @@ local function selectChoice(choice) local dialogChoice = choiceMap[choice] game.Chat:Chat( - game.Players.LocalPlayer.Character, - sanitizeMessage(dialogChoice.UserDialog), + localPlayer.Character, + sanitiseMessage(dialogChoice.UserDialog), getChatColor(currentTone()) ) wait(1) @@ -348,7 +353,7 @@ local function selectChoice(choice) ) game.Chat:Chat( currentConversationPartner, - sanitizeMessage(dialogChoice.ResponseDialog), + sanitiseMessage(dialogChoice.ResponseDialog), getChatColor(currentTone()) ) @@ -444,7 +449,7 @@ local function doDialog(dialog) local il = Instance.Lock(dialog, player) print("for instance", il) while not il do - wait() + RunService.Heartbeat:wait() il = Instance.Lock(dialog, player) print("for instance", il) end @@ -486,7 +491,7 @@ local function checkForLeaveArea() end end -local function startDialog(dialog) +local function startDialog(dialog: Dialog) if dialog.Parent and dialog.Parent:IsA "BasePart" then if player:DistanceFromCharacter(dialog.Parent.Position) @@ -509,7 +514,7 @@ local function startDialog(dialog) end end -local function removeDialog(dialog) +local function removeDialog(dialog: Dialog) if dialogMap[dialog] then dialogMap[dialog]:Remove() dialogMap[dialog] = nil @@ -520,7 +525,7 @@ local function removeDialog(dialog) end end -local function addDialog(dialog) +local function addDialog(dialog: Dialog) if dialog.Parent then if dialog.Parent:IsA "BasePart" then local chatGui = Hydrate(chatNotificationGui:Clone()) { diff --git a/luau/45284430.luau b/luau/45284430.luau index 62ac164..daa86d6 100644 --- a/luau/45284430.luau +++ b/luau/45284430.luau @@ -8,6 +8,7 @@ local Hydrate = News.Hydrate local ContentProvider = game:GetService "ContentProvider" local InsertService = game:GetService "InsertService" +local RunService = game:GetService "RunService" local RbxGui = {} @@ -111,7 +112,13 @@ local function CreateButtons(frame, buttons, yPos, ySize) end end -local function setSliderPos(newAbsPosX, slider, sliderPosition, bar, steps) +local function setSliderPos( + newAbsPosX: number, + slider: ImageButton, + sliderPosition: IntValue, + bar, + steps: number +) local newStep = steps - 1 --otherwise we really get one more step than we want local relativePosX = math.min( 1, @@ -245,7 +252,7 @@ function RbxGui.CreateStyledMessageDialog(title, message, style, buttons) end local scrollMouseCount -function RbxGui.CreateDropDownMenu(items, onSelect, forRoblox) +function RbxGui.CreateDropDownMenu(items, onSelect, forRoblox: boolean?) local width = UDim.new(0, 100) local height = UDim.new(0, 32) @@ -342,7 +349,7 @@ function RbxGui.CreateDropDownMenu(items, onSelect, forRoblox) local scrollDownButton scrollMouseCount = 0 - local setZIndex = function(baseZIndex) + local function setZIndex(baseZIndex: number) droppedDownMenu.ZIndex = baseZIndex + 1 if scrollUpButton then scrollUpButton.ZIndex = baseZIndex + 3 @@ -686,11 +693,12 @@ function RbxGui.GetFontHeight(font, fontSize) end end -local function layoutGuiObjectsHelper(frame, guiObjects, settingsTable) +local function layoutGuiObjectsHelper(frame: Frame, guiObjects, settingsTable) local totalPixels = frame.AbsoluteSize.Y local pixelsRemaining = frame.AbsoluteSize.Y - for _, child in ipairs(guiObjects) do - if child:IsA "TextLabel" or child:IsA "TextButton" then + for _, ch in ipairs(guiObjects) do + if ch:IsA "TextLabel" or ch:IsA "TextButton" then + local child = ch :: TextLabel & TextButton -- luau moment local isLabel = child:IsA "TextLabel" if isLabel then pixelsRemaining = pixelsRemaining @@ -712,7 +720,10 @@ local function layoutGuiObjectsHelper(frame, guiObjects, settingsTable) pixelsRemaining ) - if child.TextFits and child.TextBounds.Y < pixelsRemaining then + if + child.TextFits + and (child.TextBounds.Y :: number) < pixelsRemaining + then child.Visible = true if isLabel then child.Size = UDim2.new( @@ -752,7 +763,8 @@ local function layoutGuiObjectsHelper(frame, guiObjects, settingsTable) pixelsRemaining = -1 end else - --GuiObject + local child = ch :: GuiObject + -- GuiObject child.Position = UDim2.new( child.Position.X.Scale, child.Position.X.Offset, @@ -804,7 +816,7 @@ function RbxGui.LayoutGuiObjects(frame, guiObjects, settingsTable) end local recalculate = function() - wait() + RunService.Heartbeat:wait() layoutGuiObjectsHelper(wrapperFrame, guiObjects, settingsTable) end @@ -819,7 +831,7 @@ function RbxGui.LayoutGuiObjects(frame, guiObjects, settingsTable) layoutGuiObjectsHelper(wrapperFrame, guiObjects, settingsTable) end -function RbxGui.CreateSlider(steps, width, position) +function RbxGui.CreateSlider(steps: number, width: number, position) local sliderGui = New "Frame" { Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, @@ -937,8 +949,8 @@ function RbxGui.CreateTrueScrollingFrame() local lowY local highY - local dragCon - local upCon + local dragCon: RBXScriptConnection? + local upCon: RBXScriptConnection? local internalChange = false @@ -1060,18 +1072,20 @@ function RbxGui.CreateTrueScrollingFrame() Size = UDim2.new(0, 10, 0, 0), ZIndex = 2, BackgroundTransparency = 0.5, - Parent = scrollbar, } end local scrollNub = Hydrate(nub()) { Position = UDim2.new(0.5, -5, 0.5, 0), + Parent = scrollbar, } local newNub = Hydrate(nub()) { Position = UDim2.new(0.5, -5, 0.5, -2), + Parent = scrollbar, } local lastNub = Hydrate(nub()) { Position = UDim2.new(0.5, -5, 0.5, 2), + Parent = scrollbar, } scrollbar.MouseEnter:connect(function() @@ -1148,7 +1162,7 @@ function RbxGui.CreateTrueScrollingFrame() return (oldPos ~= scrollbar.Position) end - local function drillDownSetHighLow(instance) + local function drillDownSetHighLow(instance: GuiObject) if not instance or not instance:IsA "GuiObject" then return end @@ -1176,7 +1190,7 @@ function RbxGui.CreateTrueScrollingFrame() end local children = instance:GetChildren() for i = 1, #children do - drillDownSetHighLow(children[i]) + drillDownSetHighLow(children[i] :: GuiObject) end end @@ -1184,7 +1198,7 @@ function RbxGui.CreateTrueScrollingFrame() local firstChildren = scrollingFrame:GetChildren() for i = 1, #firstChildren do - drillDownSetHighLow(firstChildren[i]) + drillDownSetHighLow(firstChildren[i]) -- y no type annotation here, luau? end end @@ -1352,24 +1366,27 @@ function RbxGui.CreateTrueScrollingFrame() upCon = mouseDrag.MouseButton1Up:connect(function() scrollStamp = tick() mouseDrag.Parent = nil - upCon:disconnect() + if upCon then + -- what's upcon + -- nothing much, you? + upCon:disconnect() + end end) mouseDrag.Parent = getScreenGuiAncestor(scrollbar) doScrollUp() wait(0.2) local t = tick() - local w = 0.1 while scrollStamp == current do doScrollUp() if not scrollUpButton.Active then break - end - if tick() - t > 5 then - w = 0 + elseif tick() - t > 5 then + wait() elseif tick() - t > 2 then - w = 0.06 + wait(0.06) + else + wait(0.1) end - wait(w) end end end @@ -1462,7 +1479,13 @@ function RbxGui.CreateTrueScrollingFrame() scrollbar.MouseButton1Up:connect(scrollTick) -- local function heightCheck(instance) - -- if (highY and (instance.AbsolutePosition.Y + instance.AbsoluteSize.Y) > highY) or not highY then + -- if + -- ( + -- highY + -- and (instance.AbsolutePosition.Y + instance.AbsoluteSize.Y) + -- > highY + -- ) or not highY + -- then -- highY = instance.AbsolutePosition.Y + instance.AbsoluteSize.Y -- end -- setSliderSizeAndPosition() @@ -1489,7 +1512,7 @@ function RbxGui.CreateTrueScrollingFrame() end if prop == "Size" or prop == "Position" then - wait() + RunService.Heartbeat:wait() highLowRecheck() end end @@ -1500,7 +1523,7 @@ function RbxGui.CreateTrueScrollingFrame() end if instance.Visible then - wait() -- wait a heartbeat for sizes to reconfig + RunService.Heartbeat:wait() -- wait a heartbeat for sizes to reconfig highLowRecheck() end @@ -1519,7 +1542,7 @@ function RbxGui.CreateTrueScrollingFrame() descendantsChangeConMap[instance]:disconnect() descendantsChangeConMap[instance] = nil end - wait() -- wait a heartbeat for sizes to reconfig + RunService.Heartbeat:wait() -- wait a heartbeat for sizes to reconfig highLowRecheck() end) @@ -1930,7 +1953,7 @@ function RbxGui.CreateScrollingFrame(orderList, scrollStyle) return end reentrancyGuard = true - wait() + RunService.Heartbeat:wait() local success, err if style == "grid" then success, err = pcall(function() @@ -2136,7 +2159,11 @@ function RbxGui.CreateScrollingFrame(orderList, scrollStyle) return frame, scrollUpButton, scrollDownButton, recalculate, scrollbar end -local function binaryGrow(min, max, fits) +local function binaryGrow( + min: number, + max: number, + fits: (number) -> boolean +): number if min > max then return min end @@ -2147,17 +2174,21 @@ local function binaryGrow(min, max, fits) if fits(mid) and (biggestLegal == nil or biggestLegal < mid) then biggestLegal = mid - --Try growing + -- Try growing min = mid + 1 else - --Doesn't fit, shrink + -- Doesn't fit, shrink max = mid - 1 end end return biggestLegal end -local function binaryShrink(min, max, fits) +local function binaryShrink( + min: number, + max: number, + fits: (number) -> boolean +): number if min > max then return min end @@ -2168,27 +2199,28 @@ local function binaryShrink(min, max, fits) if fits(mid) and (smallestLegal == nil or smallestLegal > mid) then smallestLegal = mid - --It fits, shrink + -- It fits, shrink max = mid - 1 else - --Doesn't fit, grow + -- Doesn't fit, grow min = mid + 1 end end return smallestLegal end -local function getGuiOwner(instance) - while instance ~= nil do - if instance:IsA "ScreenGui" or instance:IsA "BillboardGui" then - return instance +local function hasGuiOwner(instance: Instance) + local obj: Instance? = instance + while obj do + if obj:IsA "ScreenGui" or obj:IsA "BillboardGui" then + return true end - instance = instance.Parent + obj = obj.Parent end - return nil + return false end -function RbxGui.AutoTruncateTextObject(textLabel) +function RbxGui.AutoTruncateTextObject(textLabel: TextLabel) local text = textLabel.Text local fullLabel = Hydrate(textLabel:Clone()) { @@ -2204,11 +2236,11 @@ function RbxGui.AutoTruncateTextObject(textLabel) } local shortText - local mouseEnterConnection - local mouseLeaveConnection + local mouseEnterConnection: RBXScriptConnection? + local mouseLeaveConnection: RBXScriptConnection? - local checkForResize = function() - if getGuiOwner(textLabel) == nil then + local function checkForResize() + if not hasGuiOwner(textLabel) then return end textLabel.Text = text @@ -2228,11 +2260,8 @@ function RbxGui.AutoTruncateTextObject(textLabel) --Shrink the text local textSize = binaryGrow(0, len, function(pos) - if pos == 0 then - textLabel.Text = "~" - else - textLabel.Text = `{string.sub(text, 1, pos)}~` - end + textLabel.Text = pos == 0 and "~" + or string.sub(text, 1, pos) .. "~" return textLabel.TextFits end) shortText = `{string.sub(text, 1, textSize)}~` @@ -2290,8 +2319,8 @@ function RbxGui.AutoTruncateTextObject(textLabel) end local function TransitionTutorialPages( - fromPage: Instance?, - toPage: Instance?, + fromPage: GuiObject?, + toPage: GuiObject?, transitionFrame: Frame, currentPageValue: ObjectValue ) @@ -2445,8 +2474,8 @@ end local function CreateBasicTutorialPage( name: string, handleResize: (number, number) -> (), - skipTutorial, - giveDoneButton + skipTutorial: () -> (), + giveDoneButton: boolean? -- idk ) local frame = New "Frame" { Name = "TutorialPage", @@ -2543,7 +2572,7 @@ local function CreateBasicTutorialPage( innerFrame.Size = giveDoneButton and UDim2.new(1, 0, 1, -75) or UDim2.new(1, 0, 1, -22) - local parentConnection + local parentConnection: RBXScriptConnection? local function basicHandleResize() if frame.Visible and frame.Parent then @@ -2557,7 +2586,7 @@ local function CreateBasicTutorialPage( frame.Changed:connect(function(prop) if prop == "Parent" then - if parentConnection ~= nil then + if parentConnection then parentConnection:disconnect() parentConnection = nil end @@ -2565,7 +2594,7 @@ local function CreateBasicTutorialPage( parentConnection = frame.Parent.Changed:connect( function(parentProp) if parentProp == "AbsoluteSize" then - wait() + RunService.Heartbeat:wait() basicHandleResize() end end @@ -2582,7 +2611,7 @@ local function CreateBasicTutorialPage( return frame, innerFrame end -RbxGui.CreateTextTutorialPage = function(name, text, skipTutorialFunc) +function RbxGui.CreateTextTutorialPage(name, text, skipTutorial) local frame local contentFrame @@ -2608,7 +2637,7 @@ RbxGui.CreateTextTutorialPage = function(name, text, skipTutorialFunc) end frame, contentFrame = - CreateBasicTutorialPage(name, handleResize, skipTutorialFunc) + CreateBasicTutorialPage(name, handleResize, skipTutorial) textLabel.Parent = contentFrame return frame @@ -2617,9 +2646,9 @@ end RbxGui.CreateImageTutorialPage = function( name, imageAsset, - x, - y, - skipTutorialFunc, + x: number, + y: number, + skipTutorial: () -> (), giveDoneButton ) local frame @@ -2663,7 +2692,7 @@ RbxGui.CreateImageTutorialPage = function( frame, contentFrame = CreateBasicTutorialPage( name, handleResize, - skipTutorialFunc, + skipTutorial, giveDoneButton ) imageLabel.Parent = contentFrame @@ -2671,7 +2700,12 @@ RbxGui.CreateImageTutorialPage = function( return frame end -RbxGui.AddTutorialPage = function(tutorial, tutorialPage) +type TutorialPage = GuiObject & { + NextButton: TextButton, + PrevButton: TextButton, +} + +RbxGui.AddTutorialPage = function(tutorial, tutorialPage: TutorialPage) local transitionFrame = tutorial.TransitionFrame local currentPageValue = tutorial.CurrentTutorialPage @@ -2683,7 +2717,7 @@ RbxGui.AddTutorialPage = function(tutorial, tutorialPage) local children = tutorial.Pages:GetChildren() if children and #children > 0 then tutorialPage.Name = "TutorialPage" .. (#children + 1) - local previousPage = children[#children] + local previousPage: TutorialPage = children[#children] if not previousPage:IsA "GuiObject" then error "All elements under Pages must be GuiObjects" end @@ -3066,7 +3100,7 @@ RbxGui.CreateSetPanel = function( end local function handleResize() - wait() -- neccessary to insure heartbeat happened + RunService.Heartbeat:wait() -- neccessary to insure heartbeat happened local itemPreview = setGui.SetPanel.ItemPreview @@ -3084,8 +3118,15 @@ RbxGui.CreateSetPanel = function( ) end + local function buttonImage() + return New "ImageLabel" { + Image = "", + BackgroundTransparency = 1, + } + end + local function makeInsertAssetButton() - local insertAssetButtonExample = New "Frame" { + return New "Frame" { Name = "InsertAssetButtonExample", Position = UDim2.new(0, 128, 0, 64), Size = UDim2.new(0, 64, 0, 64), @@ -3100,39 +3141,28 @@ RbxGui.CreateSetPanel = function( Name = "AssetName", Value = "", }, + New "TextButton" { + Name = "Button", + Text = "", + Style = Enum.ButtonStyle.RobloxButton, + Position = UDim2.new(0.025, 0, 0.025, 0), + Size = UDim2.new(0.95, 0, 0.95, 0), + ZIndex = 6, + Hydrate(buttonImage()) { + Name = "ButtonImage", + Position = UDim2.new(0, -7, 0, -7), + Size = UDim2.new(1, 14, 1, 14), + ZIndex = 7, + }, + }, + Hydrate(buttonImage()) { + Name = "ConfigIcon", + Visible = false, + Position = UDim2.new(1, -23, 1, -24), + Size = UDim2.new(0, 16, 0, 16), + ZIndex = 6, + }, } - - local button = New "TextButton" { - Name = "Button", - Text = "", - Style = Enum.ButtonStyle.RobloxButton, - Position = UDim2.new(0.025, 0, 0.025, 0), - Size = UDim2.new(0.95, 0, 0.95, 0), - ZIndex = 6, - Parent = insertAssetButtonExample, - } - - local buttonImage = New "ImageLabel" { - Name = "ButtonImage", - Image = "", - Position = UDim2.new(0, -7, 0, -7), - Size = UDim2.new(1, 14, 1, 14), - BackgroundTransparency = 1, - ZIndex = 7, - Parent = button, - } - - Hydrate(buttonImage:Clone()) { - Name = "ConfigIcon", - Visible = false, - Position = UDim2.new(1, -23, 1, -24), - Size = UDim2.new(0, 16, 0, 16), - Image = "", - ZIndex = 6, - Parent = insertAssetButtonExample, - } - - return insertAssetButtonExample end local function showLargePreview(insertButton) @@ -3161,9 +3191,9 @@ RbxGui.CreateSetPanel = function( end end - local function createTerrainTypeButton(name, parent) + local function createTerrainTypeButton(name: string, parent: Frame) local dropDownTextButton = New "TextButton" { - Name = `{name}Button`, + Name = name .. "Button", Font = Enum.Font.ArialBold, FontSize = Enum.FontSize.Size14, BorderSizePixel = 0, @@ -3201,7 +3231,7 @@ RbxGui.CreateSetPanel = function( return dropDownTextButton end - local function createTerrainDropDownMenu(zIndex) + local function createTerrainDropDownMenu(zIndex: number) local dropDown = New "Frame" { Name = "TerrainDropDown", BackgroundColor3 = Color3.new(0, 0, 0), @@ -3231,7 +3261,7 @@ RbxGui.CreateSetPanel = function( end) end - local function createDropDownMenuButton(parent) + local function createDropDownMenuButton(parent: Frame) local dropDownButton = New "ImageButton" { Name = "DropDownButton", Image = "http://banland.xyz/asset?id=67581509", @@ -4002,7 +4032,7 @@ RbxGui.CreateLoadingFrame = function(name, size, position) return loadingFrame, updateLoadingGuiPercent, cancelButtonClicked end -RbxGui.CreatePluginFrame = function(name, size, position, scrollable, parent) +function RbxGui.CreatePluginFrame(name: string, size, position, scrollable, parent) local function createMenuButton( size, position, @@ -4043,6 +4073,15 @@ RbxGui.CreatePluginFrame = function(name, size, position, scrollable, parent) return button end + local function separatingLineC() + return New "Frame" { + Name = "SeparatingLine", + BackgroundColor3 = Colour3(115, 115, 115), + BorderSizePixel = 0, + Size = UDim2.new(0, 1, 0, 14), + } + end + local dragBar = New "ImageButton" { Name = `{name}DragBar`, BackgroundColor3 = Colour3(39, 39, 39), @@ -4061,7 +4100,14 @@ RbxGui.CreatePluginFrame = function(name, size, position, scrollable, parent) TextXAlignment = Enum.TextXAlignment.Left, BackgroundTransparency = 1, }, + Hydrate(separatingLineC()) { + Position = UDim2.new(1, -18, 0.5, -7), + }, + Hydrate(separatingLineC()) { + Position = UDim2.new(1, -35, 0.5, -7), + }, } + if size then dragBar.Size = UDim2.new(size.X.Scale, size.X.Offset, 0, 20) + UDim2.new(0, 20, 0, 0) @@ -4181,20 +4227,6 @@ RbxGui.CreatePluginFrame = function(name, size, position, scrollable, parent) Parent = minimizeFrame, } - local separatingLine = New "Frame" { - Name = "SeparatingLine", - BackgroundColor3 = Colour3(115, 115, 115), - BorderSizePixel = 0, - Position = UDim2.new(1, -18, 0.5, -7), - Size = UDim2.new(0, 1, 0, 14), - Parent = dragBar, - } - -- otherSeparatingLine - Hydrate(separatingLine:Clone()) { - Position = UDim2.new(1, -35, 0.5, -7), - Parent = dragBar, - } - local widgetContainer = New "Frame" { Name = "WidgetContainer", BackgroundTransparency = 1, @@ -4208,22 +4240,11 @@ RbxGui.CreatePluginFrame = function(name, size, position, scrollable, parent) widgetContainer.Parent = dragBar if size then - if scrollable then - widgetContainer.Size = size - else - widgetContainer.Size = UDim2.new( - 0, - dragBar.AbsoluteSize.X, - size.Y.Scale, - size.Y.Offset - ) - end + widgetContainer.Size = scrollable and size + or UDim2.new(0, dragBar.AbsoluteSize.X, size.Y.Scale, size.Y.Offset) else - if scrollable then - widgetContainer.Size = UDim2.new(0, 163, 0, 400) - else - widgetContainer.Size = UDim2.new(0, dragBar.AbsoluteSize.X, 0, 400) - end + widgetContainer.Size = scrollable and UDim2.new(0, 163, 0, 400) + or UDim2.new(0, dragBar.AbsoluteSize.X, 0, 400) end if position then widgetContainer.Position = position + UDim2.new(0, 0, 0, 20) diff --git a/luau/46295863.luau b/luau/46295863.luau index 5011fe1..a7be9ea 100644 --- a/luau/46295863.luau +++ b/luau/46295863.luau @@ -1,6 +1,10 @@ -- CoreGui.RobloxGui.CoreScripts/Settings print "[Mercury]: Loaded corescript 46295863" +local News = require "../Modules/New" +local New = News.New +local Hydrate = News.Hydrate + local CoreGui = game:GetService "CoreGui" local GuiService = game:GetService "GuiService" local Players = game:GetService "Players" @@ -225,14 +229,15 @@ local function CreateTextButtons(frame, buttons, yPos, ySize) end for _, obj in ipairs(buttons) do - local button = Instance.new "TextButton" - button.Name = "Button" .. buttonNum - button.Font = Enum.Font.Arial - button.FontSize = Enum.FontSize.Size18 - button.AutoButtonColor = true - button.Style = Enum.ButtonStyle.RobloxButton - button.Text = obj.Text - button.TextColor3 = Color3.new(1, 1, 1) + local button = New "TextButton" { + Name = "Button" .. buttonNum, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + AutoButtonColor = true, + Style = Enum.ButtonStyle.RobloxButton, + Text = obj.Text, + TextColor3 = Color3.new(1, 1, 1), + } button.MouseButton1Click:connect(function() toggleSelection(button) obj.Function() @@ -335,102 +340,102 @@ local function createHelpDialog(baseZIndex) end end - local shield = Instance.new "Frame" - shield.Name = "HelpDialogShield" - shield.Active = true - shield.Visible = false - shield.Size = UDim2.new(1, 0, 1, 0) - shield.BackgroundColor3 = Color3I(51, 51, 51) - shield.BorderColor3 = Color3I(27, 42, 53) - shield.BackgroundTransparency = 0.4 - shield.ZIndex = baseZIndex + 1 + local shield = New "Frame" { + Name = "HelpDialogShield", + Active = true, + Visible = false, + Size = UDim2.new(1, 0, 1, 0), + BackgroundColor3 = Color3I(51, 51, 51), + BorderColor3 = Color3I(27, 42, 53), + BackgroundTransparency = 0.4, + ZIndex = baseZIndex + 1, + } - local helpDialog = Instance.new "Frame" - helpDialog.Name = "HelpDialog" - helpDialog.Style = Enum.FrameStyle.RobloxRound - helpDialog.Position = UDim2.new(0.2, 0, 0.2, 0) - helpDialog.Size = UDim2.new(0.6, 0, 0.6, 0) - helpDialog.Active = true - helpDialog.Parent = shield + local helpDialog = New "Frame" { + Name = "HelpDialog", + Style = Enum.FrameStyle.RobloxRound, + Position = UDim2.new(0.2, 0, 0.2, 0), + Size = UDim2.new(0.6, 0, 0.6, 0), + Active = true, + Parent = shield, + New "TextLabel" { + Name = "Title", + Text = "Keyboard & Mouse Controls", + Font = Enum.Font.ArialBold, + FontSize = Enum.FontSize.Size36, + Position = UDim2.new(0, 0, 0.025, 0), + Size = UDim2.new(1, 0, 0, 40), + TextColor3 = Color3.new(1, 1, 1), + BackgroundTransparency = 1, + }, + } - local titleLabel = Instance.new "TextLabel" - titleLabel.Name = "Title" - titleLabel.Text = "Keyboard & Mouse Controls" - titleLabel.Font = Enum.Font.ArialBold - titleLabel.FontSize = Enum.FontSize.Size36 - titleLabel.Position = UDim2.new(0, 0, 0.025, 0) - titleLabel.Size = UDim2.new(1, 0, 0, 40) - titleLabel.TextColor3 = Color3.new(1, 1, 1) - titleLabel.BackgroundTransparency = 1 - titleLabel.Parent = helpDialog + local buttonRow = New "Frame" { + Name = "Buttons", + Position = UDim2.new(0.1, 0, 0.07, 40), + Size = UDim2.new(0.8, 0, 0, 45), + BackgroundTransparency = 1, + Parent = helpDialog, + } - local buttonRow = Instance.new "Frame" - buttonRow.Name = "Buttons" - buttonRow.Position = UDim2.new(0.1, 0, 0.07, 40) - buttonRow.Size = UDim2.new(0.8, 0, 0, 45) - buttonRow.BackgroundTransparency = 1 - buttonRow.Parent = helpDialog + local imageFrame = New "Frame" { + Name = "ImageFrame", + Position = UDim2.new(0.05, 0, 0.075, 80), + Size = UDim2.new(0.9, 0, 0.9, -120), + BackgroundTransparency = 1, + Parent = helpDialog, + } - local imageFrame = Instance.new "Frame" - imageFrame.Name = "ImageFrame" - imageFrame.Position = UDim2.new(0.05, 0, 0.075, 80) - imageFrame.Size = UDim2.new(0.9, 0, 0.9, -120) - imageFrame.BackgroundTransparency = 1 - imageFrame.Parent = helpDialog + local layoutFrame = New "Frame" { + Name = "LayoutFrame", + Position = UDim2.new(0.5, 0, 0, 0), + Size = UDim2.new(1.5, 0, 1, 0), + BackgroundTransparency = 1, + SizeConstraint = Enum.SizeConstraint.RelativeYY, + Parent = imageFrame, + } - local layoutFrame = Instance.new "Frame" - layoutFrame.Name = "LayoutFrame" - layoutFrame.Position = UDim2.new(0.5, 0, 0, 0) - layoutFrame.Size = UDim2.new(1.5, 0, 1, 0) - layoutFrame.BackgroundTransparency = 1 - layoutFrame.SizeConstraint = Enum.SizeConstraint.RelativeYY - layoutFrame.Parent = imageFrame + local image = New "ImageLabel" { + Name = "Image", + Image = UserSettings().GameSettings.ControlMode + == Enum.ControlMode["Mouse Lock Switch"] + and mouseLockLookScreenUrl + or classicLookScreenUrl, + Position = UDim2.new(-0.5, 0, 0, 0), + Size = UDim2.new(1, 0, 1, 0), + BackgroundTransparency = 1, + Parent = layoutFrame, + } - local image = Instance.new "ImageLabel" - image.Name = "Image" - if - UserSettings().GameSettings.ControlMode - == Enum.ControlMode["Mouse Lock Switch"] - then - image.Image = mouseLockLookScreenUrl - else - image.Image = classicLookScreenUrl - end - image.Position = UDim2.new(-0.5, 0, 0, 0) - image.Size = UDim2.new(1, 0, 1, 0) - image.BackgroundTransparency = 1 - image.Parent = layoutFrame - - local buttons = {} - buttons[1] = {} - buttons[1].Text = "Look" - buttons[1].Function = function() - if - UserSettings().GameSettings.ControlMode - == Enum.ControlMode["Mouse Lock Switch"] - then - image.Image = mouseLockLookScreenUrl - else - image.Image = classicLookScreenUrl - end - end - buttons[2] = {} - buttons[2].Text = "Move" - buttons[2].Function = function() - image.Image = "http://banland.xyz/asset?id=45915811" - end - buttons[3] = {} - buttons[3].Text = "Gear" - buttons[3].Function = function() - image.Image = "http://banland.xyz/asset?id=45917596" - end - buttons[4] = {} - buttons[4].Text = "Zoom" - buttons[4].Function = function() - image.Image = "http://banland.xyz/asset?id=45915825" - end - - CreateTextButtons(buttonRow, buttons, UDim.new(0, 0), UDim.new(1, 0)) + CreateTextButtons(buttonRow, { + { + Text = "Look", + Function = function() + image.Image = UserSettings().GameSettings.ControlMode + == Enum.ControlMode["Mouse Lock Switch"] + and mouseLockLookScreenUrl + or classicLookScreenUrl + end, + }, + { + Text = "Move", + Function = function() + image.Image = "http://banland.xyz/asset?id=45915811" + end, + }, + { + Text = "Gear", + Function = function() + image.Image = "http://banland.xyz/asset?id=45917596" + end, + }, + { + Text = "Zoom", + Function = function() + image.Image = "http://banland.xyz/asset?id=45915825" + end, + }, + }, UDim.new(0, 0), UDim.new(1, 0)) -- set up listeners for type of mouse mode, but keep constructing gui at same time delay(0, function() @@ -451,79 +456,89 @@ local function createHelpDialog(baseZIndex) ) gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField.DropDownMenuButton.Changed:connect( function(prop) - if prop ~= "Text" then - return - end if - buttonRow.Button1.Style - == Enum.ButtonStyle.RobloxButtonDefault + prop ~= "Text" + and buttonRow.Button1.Style + == Enum.ButtonStyle.RobloxButtonDefault then -- only change if this is the currently selected panel - if - gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField.DropDownMenuButton.Text - == "Classic" - then - image.Image = classicLookScreenUrl - else - image.Image = mouseLockLookScreenUrl - end + image.Image = gui.UserSettingsShield.Settings.SettingsStyle.GameSettingsMenu.CameraField.DropDownMenuButton.Text + == "Classic" + and classicLookScreenUrl + or mouseLockLookScreenUrl end end ) end) - local okBtn = Instance.new "TextButton" - okBtn.Name = "OkBtn" - okBtn.Text = "OK" - okBtn.Modal = true - okBtn.Size = UDim2.new(0.3, 0, 0, 45) - okBtn.Position = UDim2.new(0.35, 0, 0.975, -50) - okBtn.Font = Enum.Font.Arial - okBtn.FontSize = Enum.FontSize.Size18 - okBtn.BackgroundTransparency = 1 - okBtn.TextColor3 = Color3.new(1, 1, 1) - okBtn.Style = Enum.ButtonStyle.RobloxButtonDefault - okBtn.MouseButton1Click:connect(function() + New "TextButton"({ + Name = "OkBtn", + Text = "OK", + Modal = true, + Size = UDim2.new(0.3, 0, 0, 45), + Position = UDim2.new(0.35, 0, 0.975, -50), + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + BackgroundTransparency = 1, + TextColor3 = Color3.new(1, 1, 1), + Style = Enum.ButtonStyle.RobloxButtonDefault, + Parent = helpDialog, + }).MouseButton1Click:connect(function() shield.Visible = false game.GuiService:RemoveCenterDialog(shield) end) - okBtn.Parent = helpDialog robloxLock(shield) return shield end local function createLeaveConfirmationMenu(baseZIndex, shield) - local frame = Instance.new "Frame" - frame.Name = "LeaveConfirmationMenu" - frame.BackgroundTransparency = 1 - frame.Size = UDim2.new(1, 0, 1, 0) - frame.Position = UDim2.new(0, 0, 2, 400) - frame.ZIndex = baseZIndex + 4 + local frame = New "Frame" { + Name = "LeaveConfirmationMenu", + BackgroundTransparency = 1, + Size = UDim2.new(1, 0, 1, 0), + Position = UDim2.new(0, 0, 2, 400), + ZIndex = baseZIndex + 4, + New "TextLabel" { + Name = "LeaveText", + Text = "Leave this game?", + Size = UDim2.new(1, 0, 0.8, 0), + TextWrap = true, + TextColor3 = Color3.new(1, 1, 1), + Font = Enum.Font.ArialBold, + FontSize = Enum.FontSize.Size36, + BackgroundTransparency = 1, + ZIndex = baseZIndex + 4, + }, + } - local yesButton = createTextButton( - "Leave", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size24, - UDim2.new(0, 128, 0, 50), - UDim2.new(0, 313, 0.8, 0) - ) - yesButton.Name = "YesButton" - yesButton.ZIndex = baseZIndex + 4 - yesButton.Parent = frame - yesButton.Modal = true - yesButton:SetVerb "Exit" + Hydrate( + createTextButton( + "Leave", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size24, + UDim2.new(0, 128, 0, 50), + UDim2.new(0, 313, 0.8, 0) + ) + )({ + Name = "YesButton", + ZIndex = baseZIndex + 4, + Parent = frame, + Modal = true, + }):SetVerb "Exit" - local noButton = createTextButton( - "Stay", - Enum.ButtonStyle.RobloxButtonDefault, - Enum.FontSize.Size24, - UDim2.new(0, 128, 0, 50), - UDim2.new(0, 90, 0.8, 0) - ) - noButton.Name = "NoButton" - noButton.Parent = frame - noButton.ZIndex = baseZIndex + 4 - noButton.MouseButton1Click:connect(function() + Hydrate( + createTextButton( + "Stay", + Enum.ButtonStyle.RobloxButtonDefault, + Enum.FontSize.Size24, + UDim2.new(0, 128, 0, 50), + UDim2.new(0, 90, 0.8, 0) + ) + )({ + Name = "NoButton", + Parent = frame, + ZIndex = baseZIndex + 4, + }).MouseButton1Click:connect(function() goToMenu( shield.Settings.SettingsStyle, "GameMainMenu", @@ -539,56 +554,72 @@ local function createLeaveConfirmationMenu(baseZIndex, shield) ) end) - local leaveText = Instance.new "TextLabel" - leaveText.Name = "LeaveText" - leaveText.Text = "Leave this game?" - leaveText.Size = UDim2.new(1, 0, 0.8, 0) - leaveText.TextWrap = true - leaveText.TextColor3 = Color3.new(1, 1, 1) - leaveText.Font = Enum.Font.ArialBold - leaveText.FontSize = Enum.FontSize.Size36 - leaveText.BackgroundTransparency = 1 - leaveText.ZIndex = baseZIndex + 4 - leaveText.Parent = frame - return frame end local function createResetConfirmationMenu(baseZIndex, shield) - local frame = Instance.new "Frame" - frame.Name = "ResetConfirmationMenu" - frame.BackgroundTransparency = 1 - frame.Size = UDim2.new(1, 0, 1, 0) - frame.Position = UDim2.new(0, 0, 2, 400) - frame.ZIndex = baseZIndex + 4 + local function resetCharacterText() + return New "TextLabel" { + Size = UDim2.new(1, 0, 0.8, 0), + TextWrap = true, + TextColor3 = Color3.new(1, 1, 1), + Font = Enum.Font.ArialBold, + BackgroundTransparency = 1, + ZIndex = baseZIndex + 4, + } + end - local yesButton = createTextButton( - "Reset", - Enum.ButtonStyle.RobloxButtonDefault, - Enum.FontSize.Size24, - UDim2.new(0, 128, 0, 50), - UDim2.new(0, 313, 0, 299) - ) - yesButton.Name = "YesButton" - yesButton.ZIndex = baseZIndex + 4 - yesButton.Parent = frame - yesButton.Modal = true - yesButton.MouseButton1Click:connect(function() + local frame = New "Frame" { + Name = "ResetConfirmationMenu", + BackgroundTransparency = 1, + Size = UDim2.new(1, 0, 1, 0), + Position = UDim2.new(0, 0, 2, 400), + ZIndex = baseZIndex + 4, + Hydrate(resetCharacterText()) { + Name = "ResetCharacterText", + Text = "Are you sure you want to reset your character?", + FontSize = Enum.FontSize.Size36, + }, + Hydrate(resetCharacterText()) { + Name = "FineResetCharacterText", + Text = "You will be put back on a spawn point", + Size = UDim2.new(0, 303, 0, 18), + Position = UDim2.new(0, 109, 0, 215), + FontSize = Enum.FontSize.Size18, + }, + } + + Hydrate( + createTextButton( + "Reset", + Enum.ButtonStyle.RobloxButtonDefault, + Enum.FontSize.Size24, + UDim2.new(0, 128, 0, 50), + UDim2.new(0, 313, 0, 299) + ) + )({ + Name = "YesButton", + ZIndex = baseZIndex + 4, + Parent = frame, + Modal = true, + }).MouseButton1Click:connect(function() resumeGameFunction(shield) resetLocalCharacter() end) - local noButton = createTextButton( - "Cancel", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size24, - UDim2.new(0, 128, 0, 50), - UDim2.new(0, 90, 0, 299) - ) - noButton.Name = "NoButton" - noButton.Parent = frame - noButton.ZIndex = baseZIndex + 4 - noButton.MouseButton1Click:connect(function() + Hydrate( + createTextButton( + "Cancel", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size24, + UDim2.new(0, 128, 0, 50), + UDim2.new(0, 90, 0, 299) + ) + )({ + Name = "NoButton", + Parent = frame, + ZIndex = baseZIndex + 4, + }).MouseButton1Click:connect(function() goToMenu( shield.Settings.SettingsStyle, "GameMainMenu", @@ -604,64 +635,62 @@ local function createResetConfirmationMenu(baseZIndex, shield) ) end) - local resetCharacterText = Instance.new "TextLabel" - resetCharacterText.Name = "ResetCharacterText" - resetCharacterText.Text = "Are you sure you want to reset your character?" - resetCharacterText.Size = UDim2.new(1, 0, 0.8, 0) - resetCharacterText.TextWrap = true - resetCharacterText.TextColor3 = Color3.new(1, 1, 1) - resetCharacterText.Font = Enum.Font.ArialBold - resetCharacterText.FontSize = Enum.FontSize.Size36 - resetCharacterText.BackgroundTransparency = 1 - resetCharacterText.ZIndex = baseZIndex + 4 - resetCharacterText.Parent = frame - - local fineResetCharacterText = resetCharacterText:Clone() - fineResetCharacterText.Name = "FineResetCharacterText" - fineResetCharacterText.Text = "You will be put back on a spawn point" - fineResetCharacterText.Size = UDim2.new(0, 303, 0, 18) - fineResetCharacterText.Position = UDim2.new(0, 109, 0, 215) - fineResetCharacterText.FontSize = Enum.FontSize.Size18 - fineResetCharacterText.Parent = frame - return frame end local settingsFrame local function createGameMainMenu(baseZIndex, shield) - local gameMainMenuFrame = Instance.new "Frame" - gameMainMenuFrame.Name = "GameMainMenu" - gameMainMenuFrame.BackgroundTransparency = 1 - gameMainMenuFrame.Size = UDim2.new(1, 0, 1, 0) - gameMainMenuFrame.ZIndex = baseZIndex + 4 - gameMainMenuFrame.Parent = settingsFrame + local gameMainMenuFrame = New "Frame" { + Name = "GameMainMenu", + BackgroundTransparency = 1, + Size = UDim2.new(1, 0, 1, 0), + ZIndex = baseZIndex + 4, + Parent = settingsFrame, + New "TextLabel" { + Name = "Title", + Text = "Game Menu", + BackgroundTransparency = 1, + TextStrokeTransparency = 0, + Font = Enum.Font.ArialBold, + FontSize = Enum.FontSize.Size36, + Size = UDim2.new(1, 0, 0, 36), + Position = UDim2.new(0, 0, 0, 4), + TextColor3 = Color3.new(1, 1, 1), + ZIndex = baseZIndex + 4, + }, + } - -- GameMainMenu Children + local function helpShortcutC() + return New "TextLabel" { + BackgroundTransparency = 1, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size12, + Size = UDim2.new(0, 30, 0, 30), + TextColor3 = Color3.new(0, 1, 0), + ZIndex = baseZIndex + 4, + } + end - local gameMainMenuTitle = Instance.new "TextLabel" - gameMainMenuTitle.Name = "Title" - gameMainMenuTitle.Text = "Game Menu" - gameMainMenuTitle.BackgroundTransparency = 1 - gameMainMenuTitle.TextStrokeTransparency = 0 - gameMainMenuTitle.Font = Enum.Font.ArialBold - gameMainMenuTitle.FontSize = Enum.FontSize.Size36 - gameMainMenuTitle.Size = UDim2.new(1, 0, 0, 36) - gameMainMenuTitle.Position = UDim2.new(0, 0, 0, 4) - gameMainMenuTitle.TextColor3 = Color3.new(1, 1, 1) - gameMainMenuTitle.ZIndex = baseZIndex + 4 - gameMainMenuTitle.Parent = gameMainMenuFrame - - local robloxHelpButton = createTextButton( - "Help", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size18, - UDim2.new(0, 164, 0, 50), - UDim2.new(0, 82, 0, 256) - ) - robloxHelpButton.Name = "HelpButton" - robloxHelpButton.ZIndex = baseZIndex + 4 - robloxHelpButton.Parent = gameMainMenuFrame + local robloxHelpButton = Hydrate( + createTextButton( + "Help", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size18, + UDim2.new(0, 164, 0, 50), + UDim2.new(0, 82, 0, 256) + ) + ) { + Name = "HelpButton", + ZIndex = baseZIndex + 4, + Parent = gameMainMenuFrame, + Hydrate(helpShortcutC()) { + Name = "HelpShortcutText", + Text = "F1", + Position = UDim2.new(0, 85, 0, 0), + Visible = false, + }, + } helpButton = robloxHelpButton local helpDialog = createHelpDialog(baseZIndex) @@ -685,119 +714,122 @@ local function createGameMainMenu(baseZIndex, shield) end) helpButton.Active = true - local helpShortcut = Instance.new "TextLabel" - helpShortcut.Name = "HelpShortcutText" - helpShortcut.Text = "F1" - helpShortcut.Visible = false - helpShortcut.BackgroundTransparency = 1 - helpShortcut.Font = Enum.Font.Arial - helpShortcut.FontSize = Enum.FontSize.Size12 - helpShortcut.Position = UDim2.new(0, 85, 0, 0) - helpShortcut.Size = UDim2.new(0, 30, 0, 30) - helpShortcut.TextColor3 = Color3.new(0, 1, 0) - helpShortcut.ZIndex = baseZIndex + 4 - helpShortcut.Parent = robloxHelpButton - - local screenshotButton = createTextButton( - "Screenshot", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size18, - UDim2.new(0, 168, 0, 50), - UDim2.new(0, 254, 0, 256) - ) - screenshotButton.Name = "ScreenshotButton" - screenshotButton.ZIndex = baseZIndex + 4 - screenshotButton.Parent = gameMainMenuFrame - screenshotButton.Visible = not macClient + local screenshotButton = Hydrate( + createTextButton( + "Screenshot", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size18, + UDim2.new(0, 168, 0, 50), + UDim2.new(0, 254, 0, 256) + ) + ) { + Name = "ScreenshotButton", + ZIndex = baseZIndex + 4, + Parent = gameMainMenuFrame, + Visible = not macClient, + Hydrate(helpShortcutC()) { + Name = "ScreenshotShortcutText", + Text = "PrintSc", + Position = UDim2.new(0, 118, 0, 0), + Visible = true, + }, + } screenshotButton:SetVerb "Screenshot" - local screenshotShortcut = helpShortcut:Clone() - screenshotShortcut.Name = "ScreenshotShortcutText" - screenshotShortcut.Text = "PrintSc" - screenshotShortcut.Position = UDim2.new(0, 118, 0, 0) - screenshotShortcut.Visible = true - screenshotShortcut.Parent = screenshotButton - - local recordVideoButton = createTextButton( - "Record Video", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size18, - UDim2.new(0, 168, 0, 50), - UDim2.new(0, 254, 0, 306) - ) - recordVideoButton.Name = "RecordVideoButton" - recordVideoButton.ZIndex = baseZIndex + 4 - recordVideoButton.Parent = gameMainMenuFrame - recordVideoButton.Visible = not macClient + local recordVideoButton = Hydrate( + createTextButton( + "Record Video", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size18, + UDim2.new(0, 168, 0, 50), + UDim2.new(0, 254, 0, 306) + ) + ) { + Name = "RecordVideoButton", + ZIndex = baseZIndex + 4, + Visible = not macClient, + Parent = gameMainMenuFrame, + Hydrate(helpShortcutC()) { + Name = "RecordVideoShortcutText", + Text = "F12", + Position = UDim2.new(0, 120, 0, 0), + Visible = hasGraphicsSlider, + }, + } recordVideoButton:SetVerb "RecordToggle" - local recordVideoShortcut = helpShortcut:Clone() - recordVideoShortcut.Visible = hasGraphicsSlider - recordVideoShortcut.Name = "RecordVideoShortcutText" - recordVideoShortcut.Text = "F12" - recordVideoShortcut.Position = UDim2.new(0, 120, 0, 0) - recordVideoShortcut.Parent = recordVideoButton - - local stopRecordButton = Instance.new "ImageButton" - stopRecordButton.Name = "StopRecordButton" - stopRecordButton.BackgroundTransparency = 1 - stopRecordButton.Image = "rbxasset://textures/ui/RecordStop.png" - stopRecordButton.Size = UDim2.new(0, 59, 0, 27) + local stopRecordButton = New "ImageButton" { + Name = "StopRecordButton", + BackgroundTransparency = 1, + Image = "rbxasset://textures/ui/RecordStop.png", + Size = UDim2.new(0, 59, 0, 27), + Visible = false, + } stopRecordButton:SetVerb "RecordToggle" stopRecordButton.MouseButton1Click:connect(function() recordVideoClick(recordVideoButton, stopRecordButton) end) - stopRecordButton.Visible = false stopRecordButton.Parent = gui - local reportAbuseButton = createTextButton( - "Report Abuse", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size18, - UDim2.new(0, 164, 0, 50), - UDim2.new(0, 82, 0, 306) - ) - reportAbuseButton.Name = "ReportAbuseButton" - reportAbuseButton.ZIndex = baseZIndex + 4 - reportAbuseButton.Parent = gameMainMenuFrame + Hydrate( + createTextButton( + "Report Abuse", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size18, + UDim2.new(0, 164, 0, 50), + UDim2.new(0, 82, 0, 306) + ) + ) { + Name = "ReportAbuseButton", + ZIndex = baseZIndex + 4, + Parent = gameMainMenuFrame, + } - local leaveGameButton = createTextButton( - "Leave Game", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size24, - UDim2.new(0, 340, 0, 50), - UDim2.new(0, 82, 0, 358) - ) - leaveGameButton.Name = "LeaveGameButton" - leaveGameButton.ZIndex = baseZIndex + 4 - leaveGameButton.Parent = gameMainMenuFrame + Hydrate( + createTextButton( + "Leave Game", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size24, + UDim2.new(0, 340, 0, 50), + UDim2.new(0, 82, 0, 358) + ) + ) { + Name = "LeaveGameButton", + ZIndex = baseZIndex + 4, + Parent = gameMainMenuFrame, + } - local resumeGameButton = createTextButton( - "Resume Game", - Enum.ButtonStyle.RobloxButtonDefault, - Enum.FontSize.Size24, - UDim2.new(0, 340, 0, 50), - UDim2.new(0, 82, 0, 54) - ) - resumeGameButton.Name = "resumeGameButton" - resumeGameButton.ZIndex = baseZIndex + 4 - resumeGameButton.Parent = gameMainMenuFrame - resumeGameButton.Modal = true - resumeGameButton.MouseButton1Click:connect(function() + Hydrate( + createTextButton( + "Resume Game", + Enum.ButtonStyle.RobloxButtonDefault, + Enum.FontSize.Size24, + UDim2.new(0, 340, 0, 50), + UDim2.new(0, 82, 0, 54) + ) + )({ + Name = "resumeGameButton", + ZIndex = baseZIndex + 4, + Parent = gameMainMenuFrame, + Modal = true, + }).MouseButton1Click:connect(function() resumeGameFunction(shield) end) - local gameSettingsButton = createTextButton( - "Game Settings", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size24, - UDim2.new(0, 340, 0, 50), - UDim2.new(0, 82, 0, 156) - ) - gameSettingsButton.Name = "SettingsButton" - gameSettingsButton.ZIndex = baseZIndex + 4 - gameSettingsButton.Parent = gameMainMenuFrame + local gameSettingsButton = Hydrate( + createTextButton( + "Game Settings", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size24, + UDim2.new(0, 340, 0, 50), + UDim2.new(0, 82, 0, 156) + ) + ) { + Name = "SettingsButton", + ZIndex = baseZIndex + 4, + Parent = gameMainMenuFrame, + } if game:FindFirstChild "LoadingGuiService" @@ -824,16 +856,19 @@ local function createGameMainMenu(baseZIndex, shield) end) end - local resetButton = createTextButton( - "Reset Character", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size24, - UDim2.new(0, 340, 0, 50), - UDim2.new(0, 82, 0, 105) - ) - resetButton.Name = "ResetButton" - resetButton.ZIndex = baseZIndex + 4 - resetButton.Parent = gameMainMenuFrame + Hydrate( + createTextButton( + "Reset Character", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size24, + UDim2.new(0, 340, 0, 50), + UDim2.new(0, 82, 0, 105) + ) + ) { + Name = "ResetButton", + ZIndex = baseZIndex + 4, + Parent = gameMainMenuFrame, + } return gameMainMenuFrame end @@ -841,165 +876,185 @@ end local mouseLockLabel, syncVideoCaptureSetting local function createGameSettingsMenu(baseZIndex, _) - local gameSettingsMenuFrame = Instance.new "Frame" - gameSettingsMenuFrame.Name = "GameSettingsMenu" - gameSettingsMenuFrame.BackgroundTransparency = 1 - gameSettingsMenuFrame.Size = UDim2.new(1, 0, 1, 0) - gameSettingsMenuFrame.ZIndex = baseZIndex + 4 + local function fullscreenShortcut() + return New "TextLabel" { + BackgroundTransparency = 1, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size12, + Size = UDim2.new(0, 30, 0, 30), + TextColor3 = Color3.new(0, 1, 0), + ZIndex = baseZIndex + 4, + } + end - local title = Instance.new "TextLabel" - title.Name = "Title" - title.Text = "Settings" - title.Size = UDim2.new(1, 0, 0, 48) - title.Position = UDim2.new(0, 9, 0, -9) - title.Font = Enum.Font.ArialBold - title.FontSize = Enum.FontSize.Size36 - title.TextColor3 = Color3.new(1, 1, 1) - title.ZIndex = baseZIndex + 4 - title.BackgroundTransparency = 1 - title.Parent = gameSettingsMenuFrame + local function qualityTextC() + return New "TextLabel" { + Font = Enum.Font.Arial, + ZIndex = baseZIndex + 4, + BackgroundTransparency = 1, + Visible = not inStudioMode, + } + end - local fullscreenText = Instance.new "TextLabel" - fullscreenText.Name = "FullscreenText" - fullscreenText.Text = "Fullscreen Mode" - fullscreenText.Size = UDim2.new(0, 124, 0, 18) - fullscreenText.Position = UDim2.new(0, 62, 0, 145) - fullscreenText.Font = Enum.Font.Arial - fullscreenText.FontSize = Enum.FontSize.Size18 - fullscreenText.TextColor3 = Color3.new(1, 1, 1) - fullscreenText.ZIndex = baseZIndex + 4 - fullscreenText.BackgroundTransparency = 1 - fullscreenText.Parent = gameSettingsMenuFrame + local gameSettingsMenuFrame = New "Frame" { + Name = "GameSettingsMenu", + BackgroundTransparency = 1, + Size = UDim2.new(1, 0, 1, 0), + ZIndex = baseZIndex + 4, + New "TextLabel" { + Name = "Title", + Text = "Settings", + Size = UDim2.new(1, 0, 0, 48), + Position = UDim2.new(0, 9, 0, -9), + Font = Enum.Font.ArialBold, + FontSize = Enum.FontSize.Size36, + TextColor3 = Color3.new(1, 1, 1), + ZIndex = baseZIndex + 4, + BackgroundTransparency = 1, + }, + New "TextLabel" { + Name = "FullscreenText", + Text = "Fullscreen Mode", + Size = UDim2.new(0, 124, 0, 18), + Position = UDim2.new(0, 62, 0, 145), + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + TextColor3 = Color3.new(1, 1, 1), + ZIndex = baseZIndex + 4, + BackgroundTransparency = 1, + }, + Hydrate(fullscreenShortcut()) { + Name = "FullscreenShortcutText", + Visible = hasGraphicsSlider, + Text = "F11", + Position = UDim2.new(0, 186, 0, 141), + }, + Hydrate(qualityTextC()) { + Name = "QualityText", + Text = "Graphics Quality", + Position = UDim2.new(0, 30, 0, 239), + TextColor3 = Color3.new(1, 1, 1), + Size = UDim2.new(0, 128, 0, 18), + FontSize = Enum.FontSize.Size18, + }, + } - local fullscreenShortcut = Instance.new "TextLabel" - fullscreenShortcut.Visible = hasGraphicsSlider - fullscreenShortcut.Name = "FullscreenShortcutText" - fullscreenShortcut.Text = "F11" - fullscreenShortcut.BackgroundTransparency = 1 - fullscreenShortcut.Font = Enum.Font.Arial - fullscreenShortcut.FontSize = Enum.FontSize.Size12 - fullscreenShortcut.Position = UDim2.new(0, 186, 0, 141) - fullscreenShortcut.Size = UDim2.new(0, 30, 0, 30) - fullscreenShortcut.TextColor3 = Color3.new(0, 1, 0) - fullscreenShortcut.ZIndex = baseZIndex + 4 - fullscreenShortcut.Parent = gameSettingsMenuFrame + local studioText = New "TextLabel" { + Name = "StudioText", + Text = "Studio Mode", + Visible = false, + Size = UDim2.new(0, 95, 0, 18), + Position = UDim2.new(0, 62, 0, 179), + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + TextColor3 = Color3.new(1, 1, 1), + ZIndex = baseZIndex + 4, + BackgroundTransparency = 1, + Parent = gameSettingsMenuFrame, + } - local studioText = Instance.new "TextLabel" - studioText.Visible = false - studioText.Name = "StudioText" - studioText.Text = "Studio Mode" - studioText.Size = UDim2.new(0, 95, 0, 18) - studioText.Position = UDim2.new(0, 62, 0, 179) - studioText.Font = Enum.Font.Arial - studioText.FontSize = Enum.FontSize.Size18 - studioText.TextColor3 = Color3.new(1, 1, 1) - studioText.ZIndex = baseZIndex + 4 - studioText.BackgroundTransparency = 1 - studioText.Parent = gameSettingsMenuFrame + local studioShortcut = Hydrate(fullscreenShortcut()) { + Name = "StudioShortcutText", + Text = "F2", + Visible = false, -- TODO: turn back on when f2 hack is fixed + Position = UDim2.new(0, 154, 0, 175), + Parent = gameSettingsMenuFrame, + } - local studioShortcut = fullscreenShortcut:Clone() - studioShortcut.Name = "StudioShortcutText" - studioShortcut.Visible = false -- TODO: turn back on when f2 hack is fixed - studioShortcut.Text = "F2" - studioShortcut.Position = UDim2.new(0, 154, 0, 175) - studioShortcut.Parent = gameSettingsMenuFrame + local fasterShortcut = Hydrate(fullscreenShortcut()) { + Name = "FasterShortcutText", + Text = "Shift + F10", + Visible = not inStudioMode, + Position = UDim2.new(0, 185, 0, 283), + Parent = gameSettingsMenuFrame, + } - local studioCheckbox + local betterQualityShortcut = Hydrate(fullscreenShortcut()) { + Name = "BetterQualityShortcut", + Text = "F10", + Position = UDim2.new(0, 394, 0, 288), + Visible = not inStudioMode, + Parent = gameSettingsMenuFrame, + } - local qualityText = Instance.new "TextLabel" - qualityText.Name = "QualityText" - qualityText.Text = "Graphics Quality" - qualityText.Size = UDim2.new(0, 128, 0, 18) - qualityText.Position = UDim2.new(0, 30, 0, 239) - qualityText.Font = Enum.Font.Arial - qualityText.FontSize = Enum.FontSize.Size18 - qualityText.TextColor3 = Color3.new(1, 1, 1) - qualityText.ZIndex = baseZIndex + 4 - qualityText.BackgroundTransparency = 1 - qualityText.Parent = gameSettingsMenuFrame - qualityText.Visible = not inStudioMode + local autoText = Hydrate(qualityTextC()) { + Name = "AutoText", + Text = "Auto", + Position = UDim2.new(0, 183, 0, 214), + TextColor3 = Color3.new(128 / 255, 128 / 255, 128 / 255), + Size = UDim2.new(0, 34, 0, 18), + FontSize = Enum.FontSize.Size18, + Parent = gameSettingsMenuFrame, + } - local autoText = qualityText:Clone() - autoText.Name = "AutoText" - autoText.Text = "Auto" - autoText.Position = UDim2.new(0, 183, 0, 214) - autoText.TextColor3 = Color3.new(128 / 255, 128 / 255, 128 / 255) - autoText.Size = UDim2.new(0, 34, 0, 18) - autoText.Parent = gameSettingsMenuFrame - autoText.Visible = not inStudioMode + local fasterText = Hydrate(qualityTextC()) { + Name = "FasterText", + Text = "Faster", + Position = UDim2.new(0, 185, 0, 274), + TextColor3 = Color3.new(95, 95, 95), + Size = UDim2.new(0, 34, 0, 18), + FontSize = Enum.FontSize.Size14, + Visible = not inStudioMode, + Parent = gameSettingsMenuFrame, + } - local fasterText = autoText:Clone() - fasterText.Name = "FasterText" - fasterText.Text = "Faster" - fasterText.Position = UDim2.new(0, 185, 0, 274) - fasterText.TextColor3 = Color3.new(95, 95, 95) - fasterText.FontSize = Enum.FontSize.Size14 - fasterText.Parent = gameSettingsMenuFrame - fasterText.Visible = not inStudioMode + local betterQualityText = Hydrate(qualityTextC()) { + Name = "BetterQualityText", + Text = "Better Quality", + TextWrap = true, + Size = UDim2.new(0, 41, 0, 28), + Position = UDim2.new(0, 390, 0, 269), + TextColor3 = Color3.new(95, 95, 95), + FontSize = Enum.FontSize.Size14, + Visible = not inStudioMode, + Parent = gameSettingsMenuFrame, + } - local fasterShortcut = fullscreenShortcut:Clone() - fasterShortcut.Name = "FasterShortcutText" - fasterShortcut.Text = "F10 + Shift" - fasterShortcut.Position = UDim2.new(0, 185, 0, 283) - fasterShortcut.Parent = gameSettingsMenuFrame - fasterShortcut.Visible = not inStudioMode - - local betterQualityText = autoText:Clone() - betterQualityText.Name = "BetterQualityText" - betterQualityText.Text = "Better Quality" - betterQualityText.TextWrap = true - betterQualityText.Size = UDim2.new(0, 41, 0, 28) - betterQualityText.Position = UDim2.new(0, 390, 0, 269) - betterQualityText.TextColor3 = Color3.new(95, 95, 95) - betterQualityText.FontSize = Enum.FontSize.Size14 - betterQualityText.Parent = gameSettingsMenuFrame - betterQualityText.Visible = not inStudioMode - - local betterQualityShortcut = fullscreenShortcut:Clone() - betterQualityShortcut.Name = "BetterQualityShortcut" - betterQualityShortcut.Text = "F10" - betterQualityShortcut.Position = UDim2.new(0, 394, 0, 288) - betterQualityShortcut.Parent = gameSettingsMenuFrame - betterQualityShortcut.Visible = not inStudioMode - - local autoGraphicsButton = createTextButton( - "X", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size18, - UDim2.new(0, 25, 0, 25), - UDim2.new(0, 187, 0, 239) - ) - autoGraphicsButton.Name = "AutoGraphicsButton" - autoGraphicsButton.ZIndex = baseZIndex + 4 - autoGraphicsButton.Parent = gameSettingsMenuFrame - autoGraphicsButton.Visible = not inStudioMode + local autoGraphicsButton = Hydrate( + createTextButton( + "X", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size18, + UDim2.new(0, 25, 0, 25), + UDim2.new(0, 187, 0, 239) + ) + ) { + Name = "AutoGraphicsButton", + ZIndex = baseZIndex + 4, + Visible = not inStudioMode, + Parent = gameSettingsMenuFrame, + } local graphicsSlider, graphicsLevel = RbxGui.CreateSlider( GraphicsQualityLevels, 150, UDim2.new(0, 230, 0, 280) ) -- graphics - 1 because slider starts at 1 instead of 0 - graphicsSlider.Parent = gameSettingsMenuFrame + + Hydrate(graphicsSlider) { + Parent = gameSettingsMenuFrame, + Visible = not inStudioMode, + } graphicsSlider.Bar.ZIndex = baseZIndex + 4 graphicsSlider.Bar.Slider.ZIndex = baseZIndex + 5 - graphicsSlider.Visible = not inStudioMode graphicsLevel.Value = math.floor((settings().Rendering:GetMaxQualityLevel() - 1) / 2) - local graphicsSetter = Instance.new "TextBox" - graphicsSetter.Name = "GraphicsSetter" - graphicsSetter.BackgroundColor3 = Color3.new(0, 0, 0) - graphicsSetter.BorderColor3 = Color3.new(128 / 255, 128 / 255, 128 / 255) - graphicsSetter.Size = UDim2.new(0, 50, 0, 25) - graphicsSetter.Position = UDim2.new(0, 450, 0, 269) - graphicsSetter.TextColor3 = Color3.new(1, 1, 1) - graphicsSetter.Font = Enum.Font.Arial - graphicsSetter.FontSize = Enum.FontSize.Size18 - graphicsSetter.Text = "Auto" - graphicsSetter.ZIndex = 1 - graphicsSetter.TextWrap = true - graphicsSetter.Parent = gameSettingsMenuFrame - graphicsSetter.Visible = not inStudioMode + local graphicsSetter = New "TextBox" { + Name = "GraphicsSetter", + BackgroundColor3 = Color3.new(0, 0, 0), + BorderColor3 = Color3.new(128 / 255, 128 / 255, 128 / 255), + Size = UDim2.new(0, 50, 0, 25), + Position = UDim2.new(0, 450, 0, 269), + TextColor3 = Color3.new(1, 1, 1), + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Text = "Auto", + ZIndex = 1, + TextWrap = true, + Parent = gameSettingsMenuFrame, + Visible = not inStudioMode, + } local isAutoGraphics = true if not inStudioMode then @@ -1290,18 +1345,21 @@ local function createGameSettingsMenu(baseZIndex, _) end end) - studioCheckbox = createTextButton( - "", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size18, - UDim2.new(0, 25, 0, 25), - UDim2.new(0, 30, 0, 176) - ) - studioCheckbox.Name = "StudioCheckbox" - studioCheckbox.ZIndex = baseZIndex + 4 - --studioCheckbox.Parent = gameSettingsMenuFrame -- todo: enable when studio h4x aren't an issue anymore + local studioCheckbox = Hydrate( + createTextButton( + "", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size18, + UDim2.new(0, 25, 0, 25), + UDim2.new(0, 30, 0, 176) + ) + ) { + Name = "StudioCheckbox", + ZIndex = baseZIndex + 4, + -- Parent, = gameSettingsMenuFrame -- todo: enable when studio h4x aren't an issue anymore + Visible = false, -- todo: enabled when studio h4x aren't an issue anymore + } studioCheckbox:SetVerb "TogglePlayMode" - studioCheckbox.Visible = false -- todo: enabled when studio h4x aren't an issue anymore local wasManualGraphics = ( settings().Rendering.QualityLevel ~= Enum.QualityLevel.Automatic @@ -1350,16 +1408,18 @@ local function createGameSettingsMenu(baseZIndex, _) end) end - local fullscreenCheckbox = createTextButton( - "", - Enum.ButtonStyle.RobloxButton, - Enum.FontSize.Size18, - UDim2.new(0, 25, 0, 25), - UDim2.new(0, 30, 0, 144) - ) - fullscreenCheckbox.Name = "FullscreenCheckbox" - fullscreenCheckbox.ZIndex = baseZIndex + 4 - fullscreenCheckbox.Parent = gameSettingsMenuFrame + local fullscreenCheckbox = Hydrate( + createTextButton( + "", + Enum.ButtonStyle.RobloxButton, + Enum.FontSize.Size18, + UDim2.new(0, 25, 0, 25), + UDim2.new(0, 30, 0, 144) + ) + ) { + Name = "FullscreenCheckbox", + ZIndex = baseZIndex + 4, + } fullscreenCheckbox:SetVerb "ToggleFullScreen" if UserSettings().GameSettings:InFullScreen() then fullscreenCheckbox.Text = "X" @@ -1376,6 +1436,7 @@ local function createGameSettingsMenu(baseZIndex, _) or "" end) end + fullscreenCheckbox.Parent = gameSettingsMenuFrame if game:FindFirstChild "NetworkClient" then -- we are playing online setDisabledState(studioText) @@ -1404,25 +1465,28 @@ local function createGameSettingsMenu(baseZIndex, _) backButton.Modal = true end - backButton.Name = "BackButton" - backButton.ZIndex = baseZIndex + 4 - backButton.Parent = gameSettingsMenuFrame + Hydrate(backButton) { + Name = "BackButton", + ZIndex = baseZIndex + 4, + Parent = gameSettingsMenuFrame, + } syncVideoCaptureSetting = nil if not macClient then - local videoCaptureLabel = Instance.new "TextLabel" - videoCaptureLabel.Name = "VideoCaptureLabel" - videoCaptureLabel.Text = "After Capturing Video" - videoCaptureLabel.Font = Enum.Font.Arial - videoCaptureLabel.FontSize = Enum.FontSize.Size18 - videoCaptureLabel.Position = UDim2.new(0, 32, 0, 100) - videoCaptureLabel.Size = UDim2.new(0, 164, 0, 18) - videoCaptureLabel.BackgroundTransparency = 1 - videoCaptureLabel.TextColor3 = Color3I(255, 255, 255) - videoCaptureLabel.TextXAlignment = Enum.TextXAlignment.Left - videoCaptureLabel.ZIndex = baseZIndex + 4 - videoCaptureLabel.Parent = gameSettingsMenuFrame + New "TextLabel" { + Name = "VideoCaptureLabel", + Text = "After Capturing Video", + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0, 32, 0, 100), + Size = UDim2.new(0, 164, 0, 18), + BackgroundTransparency = 1, + TextColor3 = Color3I(255, 255, 255), + TextXAlignment = Enum.TextXAlignment.Left, + ZIndex = baseZIndex + 4, + Parent = gameSettingsMenuFrame, + } local videoNames = {} local videoNameToItem = {} @@ -1440,13 +1504,15 @@ local function createGameSettingsMenu(baseZIndex, _) end ) - videoCaptureDropDown.Name = "VideoCaptureField" - videoCaptureDropDown.ZIndex = baseZIndex + 4 + Hydrate(videoCaptureDropDown) { + Name = "VideoCaptureField", + ZIndex = baseZIndex + 4, + Position = UDim2.new(0, 270, 0, 94), + Size = UDim2.new(0, 200, 0, 32), + Parent = gameSettingsMenuFrame, + } videoCaptureDropDown.DropDownMenuButton.ZIndex = baseZIndex + 4 videoCaptureDropDown.DropDownMenuButton.Icon.ZIndex = baseZIndex + 4 - videoCaptureDropDown.Position = UDim2.new(0, 270, 0, 94) - videoCaptureDropDown.Size = UDim2.new(0, 200, 0, 32) - videoCaptureDropDown.Parent = gameSettingsMenuFrame syncVideoCaptureSetting = function() if @@ -1467,18 +1533,19 @@ local function createGameSettingsMenu(baseZIndex, _) end end - local cameraLabel = Instance.new "TextLabel" - cameraLabel.Name = "CameraLabel" - cameraLabel.Text = "Character & Camera Controls" - cameraLabel.Font = Enum.Font.Arial - cameraLabel.FontSize = Enum.FontSize.Size18 - cameraLabel.Position = UDim2.new(0, 31, 0, 58) - cameraLabel.Size = UDim2.new(0, 224, 0, 18) - cameraLabel.TextColor3 = Color3I(255, 255, 255) - cameraLabel.TextXAlignment = Enum.TextXAlignment.Left - cameraLabel.BackgroundTransparency = 1 - cameraLabel.ZIndex = baseZIndex + 4 - cameraLabel.Parent = gameSettingsMenuFrame + New "TextLabel" { + Name = "CameraLabel", + Text = "Character & Camera Controls", + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0, 31, 0, 58), + Size = UDim2.new(0, 224, 0, 18), + TextColor3 = Color3I(255, 255, 255), + TextXAlignment = Enum.TextXAlignment.Left, + BackgroundTransparency = 1, + ZIndex = baseZIndex + 4, + Parent = gameSettingsMenuFrame, + } mouseLockLabel = CoreGui.RobloxGui:FindFirstChild("MouseLockLabel", true) @@ -1497,25 +1564,22 @@ local function createGameSettingsMenu(baseZIndex, _) UserSettings().GameSettings.ControlMode = enumNameToItem[text] pcall(function() - if - mouseLockLabel + mouseLockLabel.Visible = mouseLockLabel and UserSettings().GameSettings.ControlMode == Enum.ControlMode["Mouse Lock Switch"] - then - mouseLockLabel.Visible = true - elseif mouseLockLabel then - mouseLockLabel.Visible = false - end end) end ) - cameraDropDown.Name = "CameraField" - cameraDropDown.ZIndex = baseZIndex + 4 + + Hydrate(cameraDropDown) { + Name = "CameraField", + ZIndex = baseZIndex + 4, + Position = UDim2.new(0, 270, 0, 52), + Size = UDim2.new(0, 200, 0, 32), + Parent = gameSettingsMenuFrame, + } cameraDropDown.DropDownMenuButton.ZIndex = baseZIndex + 4 cameraDropDown.DropDownMenuButton.Icon.ZIndex = baseZIndex + 4 - cameraDropDown.Position = UDim2.new(0, 270, 0, 52) - cameraDropDown.Size = UDim2.new(0, 200, 0, 32) - cameraDropDown.Parent = gameSettingsMenuFrame return gameSettingsMenuFrame end @@ -1536,44 +1600,48 @@ if UserSettings then settingsButton = gui.BottomLeftControl:FindFirstChild "SettingsButton" if settingsButton == nil then - settingsButton = Instance.new "ImageButton" - settingsButton.Name = "SettingsButton" - settingsButton.Image = "rbxasset://textures/ui/SettingsButton.png" - settingsButton.BackgroundTransparency = 1 - settingsButton.Active = false - settingsButton.Size = UDim2.new(0, 54, 0, 46) - settingsButton.Position = UDim2.new(0, 2, 0, 50) - settingsButton.Parent = gui.BottomLeftControl + settingsButton = New "ImageButton" { + Name = "SettingsButton", + Image = "rbxasset://textures/ui/SettingsButton.png", + BackgroundTransparency = 1, + Active = false, + Size = UDim2.new(0, 54, 0, 46), + Position = UDim2.new(0, 2, 0, 50), + Parent = gui.BottomLeftControl, + } end - local shield = Instance.new "TextButton" - shield.Text = "" - shield.Name = "UserSettingsShield" - shield.Active = true - shield.AutoButtonColor = false - shield.Visible = false - shield.Size = UDim2.new(1, 0, 1, 0) - shield.BackgroundColor3 = Color3I(51, 51, 51) - shield.BorderColor3 = Color3I(27, 42, 53) - shield.BackgroundTransparency = 0.4 - shield.ZIndex = baseZIndex + 2 + local shield = New "TextButton" { + Text = "", + Name = "UserSettingsShield", + Active = true, + AutoButtonColor = false, + Visible = false, + Size = UDim2.new(1, 0, 1, 0), + BackgroundColor3 = Color3I(51, 51, 51), + BorderColor3 = Color3I(27, 42, 53), + BackgroundTransparency = 0.4, + ZIndex = baseZIndex + 2, + } mainShield = shield - local frame = Instance.new "Frame" - frame.Name = "Settings" - frame.Position = UDim2.new(0.5, -262, -0.5, -200) - frame.Size = UDim2.new(0, 525, 0, 430) - frame.BackgroundTransparency = 1 - frame.Active = true - frame.Parent = shield + local frame = New "Frame" { + Name = "Settings", + Position = UDim2.new(0.5, -262, -0.5, -200), + Size = UDim2.new(0, 525, 0, 430), + BackgroundTransparency = 1, + Active = true, + Parent = shield, + } - settingsFrame = Instance.new "Frame" - settingsFrame.Name = "SettingsStyle" - settingsFrame.Size = UDim2.new(1, 0, 1, 0) - settingsFrame.Style = Enum.FrameStyle.RobloxRound - settingsFrame.Active = true - settingsFrame.ZIndex = baseZIndex + 3 - settingsFrame.Parent = frame + settingsFrame = New "Frame" { + Name = "SettingsStyle", + Size = UDim2.new(1, 0, 1, 0), + Style = Enum.FrameStyle.RobloxRound, + Active = true, + ZIndex = baseZIndex + 3, + Parent = frame, + } local gameMainMenu = createGameMainMenu(baseZIndex, shield) gameMainMenu.Parent = settingsFrame @@ -1590,18 +1658,19 @@ if UserSettings then backToGame(gameMainMenu.RecordVideoButton, shield, settingsButton) end) - if settings():FindFirstChild "Game Options" then + local gameOptions = settings():FindFirstChild "Game Options" + if gameOptions then pcall(function() - settings() - :FindFirstChild("Game Options").VideoRecordingChangeRequest - :connect(function(recording) + gameOptions.VideoRecordingChangeRequest:connect( + function(recording) recordingVideo = recording setRecordGui( recording, gui.StopRecordButton, gameMainMenu.RecordVideoButton ) - end) + end + ) end) end @@ -1765,10 +1834,10 @@ if UserSettings then end goToMenu( - lastMenuSelection[#lastMenuSelection]["container"], - lastMenuSelection[#lastMenuSelection]["name"], - lastMenuSelection[#lastMenuSelection]["direction"], - lastMenuSelection[#lastMenuSelection]["lastSize"] + lastMenuSelection[#lastMenuSelection].container, + lastMenuSelection[#lastMenuSelection].name, + lastMenuSelection[#lastMenuSelection].direction, + lastMenuSelection[#lastMenuSelection].lastSize ) table.remove(lastMenuSelection, #lastMenuSelection) @@ -1911,17 +1980,18 @@ if UserSettings then end --UserSettings call local createSaveDialogs = function() - local shield = Instance.new "TextButton" - shield.Text = "" - shield.AutoButtonColor = false - shield.Name = "SaveDialogShield" - shield.Active = true - shield.Visible = false - shield.Size = UDim2.new(1, 0, 1, 0) - shield.BackgroundColor3 = Color3I(51, 51, 51) - shield.BorderColor3 = Color3I(27, 42, 53) - shield.BackgroundTransparency = 0.4 - shield.ZIndex = baseZIndex + 1 + local shield = New "TextButton" { + Text = "", + AutoButtonColor = false, + Name = "SaveDialogShield", + Active = true, + Visible = false, + Size = UDim2.new(1, 0, 1, 0), + BackgroundColor3 = Color3I(51, 51, 51), + BorderColor3 = Color3I(27, 42, 53), + BackgroundTransparency = 0.4, + ZIndex = baseZIndex + 1, + } local clearAndResetDialog local save @@ -1929,23 +1999,27 @@ local createSaveDialogs = function() local dontSave local cancel - local messageBoxButtons = {} - messageBoxButtons[1] = {} - messageBoxButtons[1].Text = "Save" - messageBoxButtons[1].Style = Enum.ButtonStyle.RobloxButtonDefault - messageBoxButtons[1].Function = function() - save() - end - messageBoxButtons[2] = {} - messageBoxButtons[2].Text = "Cancel" - messageBoxButtons[2].Function = function() - cancel() - end - messageBoxButtons[3] = {} - messageBoxButtons[3].Text = "Don't Save" - messageBoxButtons[3].Function = function() - dontSave() - end + local messageBoxButtons = { + { + Text = "Save", + Style = Enum.ButtonStyle.RobloxButtonDefault, + Function = function() + save() + end, + }, + { + Text = "Cancel", + Function = function() + cancel() + end, + }, + { + Text = "Don't Save", + Function = function() + dontSave() + end, + }, + } local saveDialogMessageBox = RbxGui.CreateStyledMessageDialog( "Unsaved Changes", @@ -1953,8 +2027,10 @@ local createSaveDialogs = function() "Confirm", messageBoxButtons ) - saveDialogMessageBox.Visible = true - saveDialogMessageBox.Parent = shield + Hydrate(saveDialogMessageBox) { + Visible = true, + Parent = shield, + } local errorBoxButtons = {} @@ -1987,49 +2063,50 @@ local createSaveDialogs = function() errorDialogMessageBox.Visible = false errorDialogMessageBox.Parent = shield - local spinnerDialog = Instance.new "Frame" - spinnerDialog.Name = "SpinnerDialog" - spinnerDialog.Style = Enum.FrameStyle.RobloxRound - spinnerDialog.Size = UDim2.new(0, 350, 0, 150) - spinnerDialog.Position = UDim2.new(0.5, -175, 0.5, -75) - spinnerDialog.Visible = false - spinnerDialog.Active = true - spinnerDialog.Parent = shield + local spinnerDialog = New "Frame" { + Name = "SpinnerDialog", + Style = Enum.FrameStyle.RobloxRound, + Size = UDim2.new(0, 350, 0, 150), + Position = UDim2.new(0.5, -175, 0.5, -75), + Visible = false, + Active = true, + Parent = shield, + New "TextLabel" { + Name = "WaitingLabel", + Text = "Saving to Mercury...", + Font = Enum.Font.ArialBold, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.5, 25, 0.5, 0), + TextColor3 = Color3.new(1, 1, 1), + }, + } - local waitingLabel = Instance.new "TextLabel" - waitingLabel.Name = "WaitingLabel" - waitingLabel.Text = "Saving to Mercury..." - waitingLabel.Font = Enum.Font.ArialBold - waitingLabel.FontSize = Enum.FontSize.Size18 - waitingLabel.Position = UDim2.new(0.5, 25, 0.5, 0) - waitingLabel.TextColor3 = Color3.new(1, 1, 1) - waitingLabel.Parent = spinnerDialog - - local spinnerFrame = Instance.new "Frame" - spinnerFrame.Name = "Spinner" - spinnerFrame.Size = UDim2.new(0, 80, 0, 80) - spinnerFrame.Position = UDim2.new(0.5, -150, 0.5, -40) - spinnerFrame.BackgroundTransparency = 1 - spinnerFrame.Parent = spinnerDialog + local spinnerFrame = New "Frame" { + Name = "Spinner", + Size = UDim2.new(0, 80, 0, 80), + Position = UDim2.new(0.5, -150, 0.5, -40), + BackgroundTransparency = 1, + Parent = spinnerDialog, + } local spinnerIcons = {} - local spinnerNum = 1 - while spinnerNum <= 8 do - local spinnerImage = Instance.new "ImageLabel" - spinnerImage.Name = "Spinner" .. spinnerNum - spinnerImage.Size = UDim2.new(0, 16, 0, 16) - spinnerImage.Position = UDim2.new( - 0.5 + 0.3 * math.cos(math.rad(45 * spinnerNum)), - -8, - 0.5 + 0.3 * math.sin(math.rad(45 * spinnerNum)), - -8 + for i = 1, 8 do + table.insert( + spinnerIcons, + New "ImageLabel" { + Name = "Spinner" .. i, + Size = UDim2.new(0, 16, 0, 16), + Position = UDim2.new( + 0.5 + 0.3 * math.cos(math.rad(45 * i)), + -8, + 0.5 + 0.3 * math.sin(math.rad(45 * i)), + -8 + ), + BackgroundTransparency = 1, + Image = "http://banland.xyz/asset?id=45880710", + Parent = spinnerFrame, + } ) - spinnerImage.BackgroundTransparency = 1 - spinnerImage.Image = "http://banland.xyz/asset?id=45880710" - spinnerImage.Parent = spinnerFrame - - spinnerIcons[spinnerNum] = spinnerImage - spinnerNum += 1 end save = function() @@ -2134,110 +2211,173 @@ local createReportAbuseDialog = function() reportAbuseButton = gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton - local shield = Instance.new "TextButton" - shield.Name = "ReportAbuseShield" - shield.Text = "" - shield.AutoButtonColor = false - shield.Active = true - shield.Visible = false - shield.Size = UDim2.new(1, 0, 1, 0) - shield.BackgroundColor3 = Color3I(51, 51, 51) - shield.BorderColor3 = Color3I(27, 42, 53) - shield.BackgroundTransparency = 0.4 - shield.ZIndex = baseZIndex + 1 + local shield = New "TextButton" { + Name = "ReportAbuseShield", + Text = "", + AutoButtonColor = false, + Active = true, + Visible = false, + Size = UDim2.new(1, 0, 1, 0), + BackgroundColor3 = Color3I(51, 51, 51), + BorderColor3 = Color3I(27, 42, 53), + BackgroundTransparency = 0.4, + ZIndex = baseZIndex + 1, + } local closeAndResetDialog - local messageBoxButtons = {} - messageBoxButtons[1] = {} - messageBoxButtons[1].Text = "Ok" - messageBoxButtons[1].Modal = true - messageBoxButtons[1].Function = function() - closeAndResetDialog() - end - local calmingMessageBox = RbxGui.CreateMessageDialog( - "Thanks for your report!", - "Our moderators will review the chat logs and determine what happened. The other user is probably just trying to make you mad.\n\nIf anyone used swear words, inappropriate language, or threatened you in real life, please report them for Bad Words or Threats", - messageBoxButtons - ) - calmingMessageBox.Visible = false - calmingMessageBox.Parent = shield + local messageBoxButtons = { + { + Text = "Ok", + Modal = true, + Function = function() + closeAndResetDialog() + end, + }, + } - local recordedMessageBox = RbxGui.CreateMessageDialog( - "Thanks for your report!", - "We've recorded your report for evaluation.", - messageBoxButtons - ) - recordedMessageBox.Visible = false - recordedMessageBox.Parent = shield + local calmingMessageBox = Hydrate( + RbxGui.CreateMessageDialog( + "Thanks for your report!", + "Our moderators will review the chat logs and determine what happened. The other user is probably just trying to make you mad.\n\nIf anyone used swear words, inappropriate language, or threatened you in real life, please report them for Bad Words or Threats", + messageBoxButtons + ) + ) { + Visible = false, + Parent = shield, + } - local normalMessageBox = RbxGui.CreateMessageDialog( - "Thanks for your report!", - "Our moderators will review the chat logs and determine what happened.", - messageBoxButtons - ) - normalMessageBox.Visible = false - normalMessageBox.Parent = shield + local recordedMessageBox = Hydrate( + RbxGui.CreateMessageDialog( + "Thanks for your report!", + "We've recorded your report for evaluation.", + messageBoxButtons + ) + ) { + Visible = false, + Parent = shield, + } - local frame = Instance.new "Frame" - frame.Name = "Settings" - frame.Position = UDim2.new(0.5, -250, 0.5, -200) - frame.Size = UDim2.new(0, 500, 0, 400) - frame.BackgroundTransparency = 1 - frame.Active = true - frame.Parent = shield + local normalMessageBox = Hydrate( + RbxGui.CreateMessageDialog( + "Thanks for your report!", + "Our moderators will review the chat logs and determine what happened.", + messageBoxButtons + ) + ) { + Visible = false, + Parent = shield, + } - local reportAbuseFrame = Instance.new "Frame" - reportAbuseFrame.Name = "ReportAbuseStyle" - reportAbuseFrame.Size = UDim2.new(1, 0, 1, 0) - reportAbuseFrame.Style = Enum.FrameStyle.RobloxRound - reportAbuseFrame.Active = true - reportAbuseFrame.ZIndex = baseZIndex + 1 - reportAbuseFrame.Parent = frame - - local title = Instance.new "TextLabel" - title.Name = "Title" - title.Text = "Report Abuse" - title.TextColor3 = Color3I(221, 221, 221) - title.Position = UDim2.new(0.5, 0, 0, 30) - title.Font = Enum.Font.ArialBold - title.FontSize = Enum.FontSize.Size36 - title.ZIndex = baseZIndex + 2 - title.Parent = reportAbuseFrame - - local description = Instance.new "TextLabel" - description.Name = "Description" - description.Text = - "This will send a complete report to a moderator. The moderator will review the chat log and take appropriate action." - description.TextColor3 = Color3I(221, 221, 221) - description.Position = UDim2.new(0, 0, 0, 55) - description.Size = UDim2.new(1, 0, 0, 40) - description.BackgroundTransparency = 1 - description.Font = Enum.Font.Arial - description.FontSize = Enum.FontSize.Size18 - description.TextWrap = true - description.ZIndex = baseZIndex + 2 - description.TextXAlignment = Enum.TextXAlignment.Left - description.TextYAlignment = Enum.TextYAlignment.Top - description.Parent = reportAbuseFrame - - local playerLabel = Instance.new "TextLabel" - playerLabel.Name = "PlayerLabel" - playerLabel.Text = "Which player?" - playerLabel.BackgroundTransparency = 1 - playerLabel.Font = Enum.Font.Arial - playerLabel.FontSize = Enum.FontSize.Size18 - playerLabel.Position = UDim2.new(0.025, 0, 0, 100) - playerLabel.Size = UDim2.new(0.4, 0, 0, 36) - playerLabel.TextColor3 = Color3I(255, 255, 255) - playerLabel.TextXAlignment = Enum.TextXAlignment.Left - playerLabel.ZIndex = baseZIndex + 2 - playerLabel.Parent = reportAbuseFrame + local frame = New "Frame" { + Name = "Settings", + Position = UDim2.new(0.5, -250, 0.5, -200), + Size = UDim2.new(0, 500, 0, 400), + BackgroundTransparency = 1, + Active = true, + Parent = shield, + } local abusingPlayer local abuse local submitReportButton + local abuses = { + "Swearing", + "Bullying", + "Scamming", + "Dating", + "Cheating/Exploiting", + "Personal Questions", + "Offsite Links", + "Bad Model or Script", + "Bad Username", + } + local abuseDropDown, updateAbuseSelection = RbxGui.CreateDropDownMenu( + abuses, + function(abuseText) + abuse = abuseText + if abuse and abusingPlayer then + submitReportButton.Active = true + end + end, + true + ) + + local reportAbuseFrame = New "Frame" { + Name = "ReportAbuseStyle", + Size = UDim2.new(1, 0, 1, 0), + Style = Enum.FrameStyle.RobloxRound, + Active = true, + ZIndex = baseZIndex + 1, + Parent = frame, + New "TextLabel" { + Name = "Title", + Text = "Report Abuse", + TextColor3 = Color3I(221, 221, 221), + Position = UDim2.new(0.5, 0, 0, 30), + Font = Enum.Font.ArialBold, + FontSize = Enum.FontSize.Size36, + ZIndex = baseZIndex + 2, + }, + New "TextLabel" { + Name = "Description", + Text = "This will send a complete report to a moderator. The moderator will review the chat log and take appropriate action.", + TextColor3 = Color3I(221, 221, 221), + Position = UDim2.new(0, 0, 0, 55), + Size = UDim2.new(1, 0, 0, 40), + BackgroundTransparency = 1, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + TextWrap = true, + ZIndex = baseZIndex + 2, + TextXAlignment = Enum.TextXAlignment.Left, + TextYAlignment = Enum.TextYAlignment.Top, + }, + New "TextLabel" { + Name = "PlayerLabel", + Text = "Which player?", + BackgroundTransparency = 1, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.025, 0, 0, 100), + Size = UDim2.new(0.4, 0, 0, 36), + TextColor3 = Color3I(255, 255, 255), + TextXAlignment = Enum.TextXAlignment.Left, + ZIndex = baseZIndex + 2, + }, + New "TextLabel" { + Name = "AbuseLabel", + Text = "Type of Abuse:", + Font = Enum.Font.Arial, + BackgroundTransparency = 1, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.025, 0, 0, 140), + Size = UDim2.new(0.4, 0, 0, 36), + TextColor3 = Color3I(255, 255, 255), + TextXAlignment = Enum.TextXAlignment.Left, + ZIndex = baseZIndex + 2, + }, + Hydrate(abuseDropDown) { + Name = "AbuseComboBox", + ZIndex = baseZIndex + 2, + Position = UDim2.new(0.425, 0, 0, 142), + Size = UDim2.new(0.55, 0, 0, 32), + }, + New "TextLabel" { + Name = "ShortDescriptionLabel", + Text = "Short Description: (optional)", + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.025, 0, 0, 180), + Size = UDim2.new(0.95, 0, 0, 36), + TextColor3 = Color3I(255, 255, 255), + TextXAlignment = Enum.TextXAlignment.Left, + BackgroundTransparency = 1, + ZIndex = baseZIndex + 2, + }, + } + local updatePlayerSelection local function createPlayersDropDown() local playerNames = {} @@ -2263,107 +2403,58 @@ local createReportAbuseDialog = function() end end ) - playerDropDown.Name = "PlayersComboBox" - playerDropDown.ZIndex = baseZIndex + 2 - playerDropDown.Position = UDim2.new(0.425, 0, 0, 102) - playerDropDown.Size = UDim2.new(0.55, 0, 0, 32) - return playerDropDown + return Hydrate(playerDropDown) { + Name = "PlayersComboBox", + ZIndex = baseZIndex + 2, + Position = UDim2.new(0.425, 0, 0, 102), + Size = UDim2.new(0.55, 0, 0, 32), + } end - local abuseLabel = Instance.new "TextLabel" - abuseLabel.Name = "AbuseLabel" - abuseLabel.Text = "Type of Abuse:" - abuseLabel.Font = Enum.Font.Arial - abuseLabel.BackgroundTransparency = 1 - abuseLabel.FontSize = Enum.FontSize.Size18 - abuseLabel.Position = UDim2.new(0.025, 0, 0, 140) - abuseLabel.Size = UDim2.new(0.4, 0, 0, 36) - abuseLabel.TextColor3 = Color3I(255, 255, 255) - abuseLabel.TextXAlignment = Enum.TextXAlignment.Left - abuseLabel.ZIndex = baseZIndex + 2 - abuseLabel.Parent = reportAbuseFrame - - local abuses = { - "Swearing", - "Bullying", - "Scamming", - "Dating", - "Cheating/Exploiting", - "Personal Questions", - "Offsite Links", - "Bad Model or Script", - "Bad Username", + local shortDescriptionWrapper = New "Frame" { + Name = "ShortDescriptionWrapper", + Position = UDim2.new(0.025, 0, 0, 220), + Size = UDim2.new(0.95, 0, 1, -310), + BackgroundColor3 = Color3I(0, 0, 0), + BorderSizePixel = 0, + ZIndex = baseZIndex + 2, + Parent = reportAbuseFrame, } - local abuseDropDown, updateAbuseSelection = RbxGui.CreateDropDownMenu( - abuses, - function(abuseText) - abuse = abuseText - if abuse and abusingPlayer then - submitReportButton.Active = true - end - end, - true - ) - abuseDropDown.Name = "AbuseComboBox" - abuseDropDown.ZIndex = baseZIndex + 2 - abuseDropDown.Position = UDim2.new(0.425, 0, 0, 142) - abuseDropDown.Size = UDim2.new(0.55, 0, 0, 32) - abuseDropDown.Parent = reportAbuseFrame - local shortDescriptionLabel = Instance.new "TextLabel" - shortDescriptionLabel.Name = "ShortDescriptionLabel" - shortDescriptionLabel.Text = "Short Description: (optional)" - shortDescriptionLabel.Font = Enum.Font.Arial - shortDescriptionLabel.FontSize = Enum.FontSize.Size18 - shortDescriptionLabel.Position = UDim2.new(0.025, 0, 0, 180) - shortDescriptionLabel.Size = UDim2.new(0.95, 0, 0, 36) - shortDescriptionLabel.TextColor3 = Color3I(255, 255, 255) - shortDescriptionLabel.TextXAlignment = Enum.TextXAlignment.Left - shortDescriptionLabel.BackgroundTransparency = 1 - shortDescriptionLabel.ZIndex = baseZIndex + 2 - shortDescriptionLabel.Parent = reportAbuseFrame + local shortDescriptionBox = New "TextBox" { + Name = "TextBox", + Text = "", + ClearTextOnFocus = false, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0, 3, 0, 3), + Size = UDim2.new(1, -6, 1, -6), + TextColor3 = Color3I(255, 255, 255), + TextXAlignment = Enum.TextXAlignment.Left, + TextYAlignment = Enum.TextYAlignment.Top, + TextWrap = true, + BackgroundColor3 = Color3I(0, 0, 0), + BorderSizePixel = 0, + ZIndex = baseZIndex + 2, + Parent = shortDescriptionWrapper, + } - local shortDescriptionWrapper = Instance.new "Frame" - shortDescriptionWrapper.Name = "ShortDescriptionWrapper" - shortDescriptionWrapper.Position = UDim2.new(0.025, 0, 0, 220) - shortDescriptionWrapper.Size = UDim2.new(0.95, 0, 1, -310) - shortDescriptionWrapper.BackgroundColor3 = Color3I(0, 0, 0) - shortDescriptionWrapper.BorderSizePixel = 0 - shortDescriptionWrapper.ZIndex = baseZIndex + 2 - shortDescriptionWrapper.Parent = reportAbuseFrame - - local shortDescriptionBox = Instance.new "TextBox" - shortDescriptionBox.Name = "TextBox" - shortDescriptionBox.Text = "" - shortDescriptionBox.ClearTextOnFocus = false - shortDescriptionBox.Font = Enum.Font.Arial - shortDescriptionBox.FontSize = Enum.FontSize.Size18 - shortDescriptionBox.Position = UDim2.new(0, 3, 0, 3) - shortDescriptionBox.Size = UDim2.new(1, -6, 1, -6) - shortDescriptionBox.TextColor3 = Color3I(255, 255, 255) - shortDescriptionBox.TextXAlignment = Enum.TextXAlignment.Left - shortDescriptionBox.TextYAlignment = Enum.TextYAlignment.Top - shortDescriptionBox.TextWrap = true - shortDescriptionBox.BackgroundColor3 = Color3I(0, 0, 0) - shortDescriptionBox.BorderSizePixel = 0 - shortDescriptionBox.ZIndex = baseZIndex + 2 - shortDescriptionBox.Parent = shortDescriptionWrapper - - submitReportButton = Instance.new "TextButton" - submitReportButton.Name = "SubmitReportBtn" - submitReportButton.Active = false - submitReportButton.Modal = true - submitReportButton.Font = Enum.Font.Arial - submitReportButton.FontSize = Enum.FontSize.Size18 - submitReportButton.Position = UDim2.new(0.1, 0, 1, -80) - submitReportButton.Size = UDim2.new(0.35, 0, 0, 50) - submitReportButton.AutoButtonColor = true - submitReportButton.Style = Enum.ButtonStyle.RobloxButtonDefault - submitReportButton.Text = "Submit Report" - submitReportButton.TextColor3 = Color3I(255, 255, 255) - submitReportButton.ZIndex = baseZIndex + 2 - submitReportButton.Parent = reportAbuseFrame + submitReportButton = New "TextButton" { + Name = "SubmitReportBtn", + Active = false, + Modal = true, + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.1, 0, 1, -80), + Size = UDim2.new(0.35, 0, 0, 50), + AutoButtonColor = true, + Style = Enum.ButtonStyle.RobloxButtonDefault, + Text = "Submit Report", + TextColor3 = Color3I(255, 255, 255), + ZIndex = baseZIndex + 2, + Parent = reportAbuseFrame, + } submitReportButton.MouseButton1Click:connect(function() if submitReportButton.Active then @@ -2387,18 +2478,19 @@ local createReportAbuseDialog = function() end end) - local cancelButton = Instance.new "TextButton" - cancelButton.Name = "CancelBtn" - cancelButton.Font = Enum.Font.Arial - cancelButton.FontSize = Enum.FontSize.Size18 - cancelButton.Position = UDim2.new(0.55, 0, 1, -80) - cancelButton.Size = UDim2.new(0.35, 0, 0, 50) - cancelButton.AutoButtonColor = true - cancelButton.Style = Enum.ButtonStyle.RobloxButtonDefault - cancelButton.Text = "Cancel" - cancelButton.TextColor3 = Color3I(255, 255, 255) - cancelButton.ZIndex = baseZIndex + 2 - cancelButton.Parent = reportAbuseFrame + local cancelButton = New "TextButton" { + Name = "CancelBtn", + Font = Enum.Font.Arial, + FontSize = Enum.FontSize.Size18, + Position = UDim2.new(0.55, 0, 1, -80), + Size = UDim2.new(0.35, 0, 0, 50), + AutoButtonColor = true, + Style = Enum.ButtonStyle.RobloxButtonDefault, + Text = "Cancel", + TextColor3 = Color3I(255, 255, 255), + ZIndex = baseZIndex + 2, + Parent = reportAbuseFrame, + } closeAndResetDialog = function() --Delete old player combo box @@ -2448,94 +2540,6 @@ local createReportAbuseDialog = function() return shield end ---[=[ -local function createChatBar() - --Only show a chat bar if we are a NetworkClient - waitForChild(game, "NetworkClient") - - waitForChild(game, "Players") - waitForProperty(game.Players, "LocalPlayer") - - local chatBar = Instance.new "Frame" - chatBar.Name = "ChatBar" - chatBar.Size = UDim2.new(1, 0, 0, 22) - chatBar.Position = UDim2.new(0, 0, 1, 0) - chatBar.BackgroundColor3 = Color3.new(0, 0, 0) - chatBar.BorderSizePixel = 0 - - local chatBox = Instance.new "TextBox" - chatBox.Text = "" - chatBox.Visible = false - chatBox.Size = UDim2.new(1, -4, 1, 0) - chatBox.Position = UDim2.new(0, 2, 0, 0) - chatBox.TextXAlignment = Enum.TextXAlignment.Left - chatBox.Font = Enum.Font.Arial - chatBox.ClearTextOnFocus = false - chatBox.FontSize = Enum.FontSize.Size14 - chatBox.TextColor3 = Color3.new(1, 1, 1) - chatBox.BackgroundTransparency = 1 - --chatBox.Parent = chatBar - - local chatButton = Instance.new "TextButton" - chatButton.Size = UDim2.new(1, -4, 1, 0) - chatButton.Position = UDim2.new(0, 2, 0, 0) - chatButton.AutoButtonColor = false - chatButton.Text = 'To chat click here or press "/" key' - chatButton.TextXAlignment = Enum.TextXAlignment.Left - chatButton.Font = Enum.Font.Arial - chatButton.FontSize = Enum.FontSize.Size14 - chatButton.TextColor3 = Color3.new(1, 1, 1) - chatButton.BackgroundTransparency = 1 - --chatButton.Parent = chatBar - - local activateChat = function() - if chatBox.Visible then - return - end - chatButton.Visible = false - chatBox.Text = "" - chatBox.Visible = true - chatBox:CaptureFocus() - end - - chatButton.MouseButton1Click:connect(activateChat) - - -- local hotKeyEnabled = true - local toggleHotKey = function(_) - -- hotKeyEnabled = value - end - - -- local guiService = game:GetService "GuiService" - --[[local newChatMode = ]] - pcall(function() - --guiService:AddSpecialKey(Enum.SpecialKey.ChatHotkey) - --guiService.SpecialKeyPressed:connect(function(key) if key == Enum.SpecialKey.ChatHotkey and hotKeyEnabled then activateChat() end end) - end) - -- if not newChatMode then - --guiService:AddKey("/") - --guiService.KeyPressed:connect(function(key) if key == "/" and hotKeyEnabled then activateChat() end end) - -- end - - chatBox.FocusLost:connect(function(enterPressed) - if enterPressed then - if chatBox.Text ~= "" then - local str = chatBox.Text - if string.sub(str, 1, 1) == "%" then - game.Players:TeamChat(string.sub(str, 2)) - else - game.Players:Chat(str) - end - end - end - chatBox.Text = "" - chatBox.Visible = false - chatButton.Visible = true - end) - robloxLock(chatBar) - return chatBar, toggleHotKey -end -]=] - --Spawn a thread for the Save dialogs local isSaveDialogSupported = pcall(function() -- local var = game.LocalSaveEnabled @@ -2579,43 +2583,3 @@ delay(0, function() gui.UserSettingsShield.Settings.SettingsStyle.GameMainMenu.ReportAbuseButton.Active = true end) - ---Spawn a thread for Chat Bar --- local success, luaChat = pcall(function() --- return game.GuiService.UseLuaChat --- end) - ---[[ -if success and luaChat then - delay(0, function() - waitForChild(game, "Players") - waitForProperty(game.Players, "LocalPlayer") - - local advancedChatBarSupported = game.Players.LocalPlayer.ChatMode - local chatBar, toggleHotKey = createChatBar() - - if advancedChatBarSupported then - local function toggleChatBar(chatMode) - if chatMode == Enum.ChatMode.Menu then - chatBar.Parent = nil - game.GuiService:SetGlobalSizeOffsetPixel(0, 0) - toggleHotKey(false) - elseif chatMode == Enum.ChatMode.TextAndMenu then - --chatBar.Parent = gui - --game.GuiService:SetGlobalSizeOffsetPixel(0,-22) - toggleHotKey(true) - end - end - game.Players.LocalPlayer.Changed:connect(function(prop) - if prop == "ChatMode" then - toggleChatBar(game.Players.LocalPlayer.ChatMode) - end - end) - toggleChatBar(game.Players.LocalPlayer.ChatMode) - else - --chatBar.Parent = gui - --game.GuiService:SetGlobalSizeOffsetPixel(0,-22) - end - end) -end -]] diff --git a/luau/48488235.luau b/luau/48488235.luau index 2d1b6c9..8cd8397 100644 --- a/luau/48488235.luau +++ b/luau/48488235.luau @@ -1,7 +1,10 @@ -- CoreGui.RobloxGui.CoreScripts/PlayerListScript print "[Mercury]: Loaded corescript 48488235" +local RunService = game:GetService "RunService" + local New = (require "../Modules/New").New +local log = require "../Modules/Logger" -------------------- -- Super Util @@ -623,43 +626,6 @@ local BigButton = New "ImageButton" { Parent = ScreenGui, } -local debugFrame = New "Frame" { - Name = "debugframe", - -- Position = UDim2.new(0, 0, 0, 0), - -- Size = UDim2.new(0, 150, 0, 800),--0.99000001 - -- BackgroundTransparency = 1, - BackgroundTransparency = 1, - Position = UDim2.new(0.25, 0, 0.300000012, 0), - Size = UDim2.new(0.5, 0, 0.370000005, 0), - MakeBackgroundGuiObj "http://banland.xyz/asset?id=96506233", -} -local debugOutput = New "TextLabel" { - BackgroundTransparency = 0.8, - Position = UDim2.new(0, 0, 0.5, 0), - Size = UDim2.new(1, 0, 0.5, 0), - Parent = debugFrame, - Font = "ArialBold", - Text = "--", - FontSize = "Size14", - TextWrapped = true, - TextColor3 = Color3.new(1, 1, 1), - TextStrokeColor3 = Color3.new(0, 0, 0), - TextStrokeTransparency = 0, - TextXAlignment = "Right", - TextYAlignment = "Center", -} - ---[[ - simple function to toggle the display of debug output ---]] -local DebugPrintEnabled = true -local function debugprint(str) - --print(str) - if DebugPrintEnabled then - debugOutput.Text = str - end -end - --[[ obligatory wait for child function @Args: @@ -669,8 +635,8 @@ end --]] local function WaitForChild(parent, child) while not parent:FindFirstChild(child) do - wait() - debugprint(` child {parent.Name} waiting for {child}`) + RunService.Heartbeat:wait() + log(` child {parent.Name} waiting for {child}`) end return parent[child] end @@ -833,7 +799,7 @@ local function TweenProperty(obj, propName, inita: number, enda: number, length) while tick() - startTime < length do obj[propName] = ((enda - inita) * ((tick() - startTime) / length)) + inita - wait() + RunService.Heartbeat:wait() end obj[propName] = enda end @@ -860,13 +826,13 @@ local function WaitForClick(frameParent, polledFunction, exitFunction) if connection2 then connection2:disconnect() end - -- debugprint "mouse up!" + -- log "mouse up!" end) connection2 = BigButton.MouseMoved:connect(function(nx, ny) polledFunction(nx, ny) end) - -- debugprint "waiting for click!" + -- log "waiting for click!" BigButton.Visible = true BigButton.Active = true BigButton.Parent = frameParent @@ -876,7 +842,7 @@ local function WaitForClick(frameParent, polledFunction, exitFunction) BigButton.Visible = false connection:disconnect() connection2:disconnect() - debugprint "forced out of wait for click" + log "forced out of wait for click" end end) WaitForClickLock = false @@ -971,7 +937,7 @@ local function OnPrivilegeLevelSelect( MemberButton, AdminButton ) - debugprint "setting privilege level" + log "setting privilege level" SetPrivilegeRank(player, nlevel) HighlightMyRank( player, @@ -1018,7 +984,7 @@ local function OnSubmitAbuse() then CalmingAbuseBox.Parent = ReportAbuseShield else - debugprint "opening abuse box" + log "opening abuse box" NormalAbuseBox.Parent = ReportAbuseShield end else @@ -1050,7 +1016,7 @@ end opens the abuse dialog, initialises text to display selectedplayer --]] local function OpenAbuseDialog() - debugprint "adding report dialog" + log "adding report dialog" AbusePlayerLabel.Text = SelectedPlayer.Name --AbuseDescriptionBox.Text = "" PopUpPanel:TweenPosition( @@ -1304,7 +1270,7 @@ local function UpdateHeaderNameSize() tHeader.FontSize = FONT_SIZES[fSize] Delay(0.2, function() while tHeader.TextBounds.x == 0 do - wait() + RunService.Heartbeat:wait() end while tHeader.TextBounds.x - NormalBounds.X.Offset > 1 do fSize -= 1 @@ -1687,8 +1653,8 @@ end --]] local function BaseUpdate() while BaseUpdateLock do - debugprint "in baseupdate lock" - wait() + log "in baseupdate lock" + RunService.Heartbeat:wait() end BaseUpdateLock = true -- print "baseupdate" @@ -1720,7 +1686,7 @@ local function BaseUpdate() UpdateScrollPosition() UpdateScrollBarVisibility() - -- debugprint "EndBaseUpdate" + -- log "EndBaseUpdate" BaseUpdateLock = false end @@ -1732,10 +1698,10 @@ RecreateScoreColumns = function(ptable) end local nscoretxt = panel:FindFirstChild("PlayerScore"):Clone() local thisScore - --here lies the resting place of a once great and terrible bug - --may its treachery never be forgotten, lest its survivors fall for it again - --RIP the leaderstat bug, oct 2012-nov 2012 - wait() + -- here lies the resting place of a once great and terrible bug + -- may its treachery never be forgotten, lest its survivors fall for it again + -- RIP the leaderstat bug, oct 2012-nov 2012 + RunService.Heartbeat:wait() if entry.Player:FindFirstChild "leaderstats" and entry.Player.leaderstats:FindFirstChild(scoreval.Name) @@ -1754,7 +1720,7 @@ RecreateScoreColumns = function(ptable) nscoretxt.Name = scoreval.Name nscoretxt.Text = tostring(GetScoreValue(thisScore)) if scoreval.Name == ScoreNames[1]["Name"] then - debugprint "changing score" + log "changing score" entry.Score = GetScoreValue(thisScore) if entry.Player == LocalPlayer then HeaderScore.Text = tostring(GetScoreValue(thisScore)) @@ -1778,8 +1744,8 @@ RecreateScoreColumns = function(ptable) end while AddingStatLock do - debugprint "In Adding Stat Lock2" - wait() + log "In Adding Stat Lock2" + RunService.Heartbeat:wait() end AddingStatLock = true local Xoffset = 5 --15 --current offset from Right @@ -1799,7 +1765,7 @@ RecreateScoreColumns = function(ptable) -- make an entry for this object local nentry = MakeScoreEntry(entry, scoreval, panel) if nentry then - debugprint(`adding {nentry.Name} to {entry.Player.Name}`) + log(`adding {nentry.Name} to {entry.Player.Name}`) nentry.Parent = panel -- add score to team if @@ -2033,8 +1999,8 @@ end local function StatAdded(nchild, playerEntry) -- dont re - add a leaderstat I alreday have while AddingStatLock do - debugprint "in stat added function lock" - wait() + log "in stat added function lock" + RunService.Heartbeat:wait() end AddingStatLock = true if @@ -2109,12 +2075,12 @@ end --]] local function StatRemoved(nchild, playerEntry) while AddingStatLock do - debugprint "In Adding Stat Lock1" - wait() + log "In Adding Stat Lock1" + RunService.Heartbeat:wait() end AddingStatLock = true if playerEntry.Frame:FindFirstChild(nchild.Name) then - debugprint "Destroyed frame!" + log "Destroyed frame!" playerEntry.Frame[nchild.Name].Parent = nil end if not DoesStatExist(nchild.Name, playerEntry.Player) then @@ -2268,7 +2234,7 @@ local function InitMovingPanel(entry, player) local nextIndex = 2 local friendStatus = GetFriendStatus(player) - debugprint(tostring(friendStatus)) + log(tostring(friendStatus)) local showRankMenu = false -- IsPersonalServer -- and LocalPlayer.PersonalServerRank >= PrivilegeLevel.Admin @@ -2391,7 +2357,7 @@ local function InitMovingPanel(entry, player) 0, myFrame.AbsolutePosition.Y ) - wait() + RunService.Heartbeat:wait() end end) end @@ -2434,9 +2400,7 @@ local function StartDrag(entry, startx, starty) startY = AbsoluteToPercent(nx, ny).Y end local nowY = AbsoluteToPercent(nx, ny).Y - debugprint( - `drag dist {Vector2.new(startx - nx, starty - ny).magnitude}` - ) + log(`drag dist {Vector2.new(startx - nx, starty - ny).magnitude}`) if Vector2.new(startx - nx, starty - ny).magnitude > MOUSE_DRAG_DISTANCE @@ -2462,9 +2426,9 @@ end local function StartMinimizeDrag() Delay(0, function() local startTime = tick() - debugprint "Got Click2" + log "Got Click2" local function dragExit() - -- debugprint "undone click2" + -- log "undone click2" if tick() - startTime < 0.25 then --was click ToggleMinimize() else --was drag @@ -2660,8 +2624,8 @@ end --]] local function LeaderstatsRemoved(_, playerEntry) while AddingFrameLock do - debugprint(`waiting to insert {playerEntry.Player.Name}`) - wait() + log(`waiting to insert {playerEntry.Player.Name}`) + RunService.Heartbeat:wait() end AddingFrameLock = true RemoveAllStats(playerEntry) @@ -2685,8 +2649,8 @@ end local function RemoveNeutralTeam() while NeutralTeamLock do - debugprint "in neutral team lock" - wait() + log "in neutral team lock" + RunService.Heartbeat:wait() end NeutralTeamLock = true NeutralTeam.Frame:Destroy() @@ -2756,8 +2720,8 @@ end --]] local function AddNeutralTeam() while NeutralTeamLock do - debugprint "in neutral team 2 lock" - wait() + log "in neutral team 2 lock" + RunService.Heartbeat:wait() end NeutralTeamLock = true @@ -2821,7 +2785,7 @@ local function SetPlayerToTeam(entry) end -- if player was set to an invalid team, then set it back to neutral if not setToTeam and #(game.Teams:GetTeams()) > 0 then - debugprint(`{entry.Player.Name} could not find team`) + log(`{entry.Player.Name} could not find team`) entry.MyTeam = nil if not NeutralTeam then AddNeutralTeam() @@ -2841,25 +2805,25 @@ end --]] local function PlayerChanged(entry, property) while PlayerChangedLock do - debugprint "in playerchanged lock" - wait() + log "in playerchanged lock" + RunService.Heartbeat:wait() end PlayerChangedLock = true if property == "Neutral" then -- if player changing to neutral if entry.Player.Neutral and #(game.Teams:GetTeams()) > 0 then - debugprint(`{entry.Player.Name} setting to neutral`) + log(`{entry.Player.Name} setting to neutral`) FindRemovePlayerFromTeam(entry) entry.MyTeam = nil if not NeutralTeam then - debugprint(`{entry.Player.Name} creating neutral team`) + log(`{entry.Player.Name} creating neutral team`) AddNeutralTeam() else - debugprint(`{entry.Player.Name} adding to neutral team`) + log(`{entry.Player.Name} adding to neutral team`) AddPlayerToTeam(NeutralTeam, entry) end elseif #(game.Teams:GetTeams()) > 0 then -- else player switching to a team, or a weird edgecase - debugprint(`{entry.Player.Name} has been set non-neutral`) + log(`{entry.Player.Name} has been set non-neutral`) SetPlayerToTeam(entry) end BaseUpdate() @@ -2868,7 +2832,7 @@ local function PlayerChanged(entry, property) and not entry.Player.Neutral and entry.Player ~= entry.MyTeam then - debugprint(`{entry.Player.Name} setting to new team`) + log(`{entry.Player.Name} setting to new team`) SetPlayerToTeam(entry) BaseUpdate() elseif property == "Name" or property == "MembershipType" then @@ -2899,8 +2863,8 @@ end --]] local function InsertPlayerFrame(nplayer) while AddingFrameLock do - debugprint(`waiting to insert {nplayer.Name}`) - wait() + log(`waiting to insert {nplayer.Name}`) + RunService.Heartbeat:wait() end AddingFrameLock = true @@ -2999,8 +2963,8 @@ local function InsertPlayerFrame(nplayer) nplayer.ChildAdded:connect(function(nchild) if nchild.Name == "leaderstats" then while AddingFrameLock do - debugprint "in adding leaderstats lock" - wait() + log "in adding leaderstats lock" + RunService.Heartbeat:wait() end AddingFrameLock = true LeaderstatsAdded(nentry) @@ -3034,8 +2998,8 @@ end --]] local function RemovePlayerFrame(tplayer) while AddingFrameLock do - debugprint "in removing player frame lock" - wait() + log "in removing player frame lock" + RunService.Heartbeat:wait() end AddingFrameLock = true @@ -3072,7 +3036,7 @@ Players.ChildRemoved:connect(RemovePlayerFrame) local function OnFriendshipChanged(player, friendStatus) Delay(0.5, function() - debugprint( + log( `friend status changed for {player.Name} {friendStatus} vs {GetFriendStatus( player )}` @@ -3086,7 +3050,7 @@ local function OnFriendshipChanged(player, friendStatus) elseif nicon ~= "" and entry.Frame.FriendLabel.Image == "" then entry.Frame.TitleFrame.Title.Position = entry.Frame.TitleFrame.Title.Position + UDim2.new(0, 17, 0, 0) - debugprint(`confirmed status {player.Name}`) + log(`confirmed status {player.Name}`) end entry.Frame.FriendLabel.Image = nicon return @@ -3137,8 +3101,8 @@ end --]] local function RemoveTeamFrame(nteam) while AddingFrameLock do - debugprint "in removing team frame lock" - wait() + log "in removing team frame lock" + RunService.Heartbeat:wait() end AddingFrameLock = true -- if IsMinimized.Value then @@ -3152,7 +3116,7 @@ local function RemoveTeamFrame(nteam) end end if #TeamFrames == 0 then - debugprint "removeteamframe, remove neutral" + log "removeteamframe, remove neutral" if NeutralTeam then RemoveNeutralTeam() end @@ -3198,8 +3162,8 @@ end --]] local function InsertTeamFrame(nteam) while AddingFrameLock do - debugprint "in adding team frame lock" - wait() + log "in adding team frame lock" + RunService.Heartbeat:wait() end AddingFrameLock = true --for _,i in pairs(TeamFrames) do @@ -3299,7 +3263,7 @@ game.GuiService:AddKey "\t" local LastTabTime = time() game.GuiService.KeyPressed:connect(function(key) if key == "\t" then - debugprint "caught tab key" + log "caught tab key" local modalCheck, isModal = pcall(function() return game.GuiService.IsModalDialog end) @@ -3362,8 +3326,8 @@ pcall(function() end) while not game:GetService "Teams" do - wait() - debugprint "Waiting For Teams" + RunService.Heartbeat:wait() + log "Waiting For Teams" end for _, i in pairs(game.Teams:GetTeams()) do TeamAdded(i) diff --git a/luau/53878047.luau b/luau/53878047.luau index d53d3f4..b073066 100644 --- a/luau/53878047.luau +++ b/luau/53878047.luau @@ -29,19 +29,15 @@ waitForProperty(game.Players, "LocalPlayer") local function SlotNumber() return New "TextLabel" { - Name = "SlotNumber", BackgroundTransparency = 1, BorderSizePixel = 0, Font = Enum.Font.ArialBold, FontSize = Enum.FontSize.Size18, - Position = UDim2.new(0, 0, 0, 0), Size = UDim2.new(0, 10, 0, 15), - TextColor3 = Color3.new(1, 1, 1), TextTransparency = 0, TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Bottom, RobloxLocked = true, - ZIndex = 5, } end @@ -160,7 +156,12 @@ local CurrentLoadout = New "Frame" { TextWrap = true, ZIndex = 5.0, }, - SlotNumber(), + Hydrate(SlotNumber()) { + Name = "SlotNumber", + TextColor3 = Color3.new(1, 1, 1), + Position = UDim2.new(0, 0, 0, 0), + ZIndex = 5, + }, Hydrate(SlotNumber()) { Name = "SlotNumberDownShadow", TextColor3 = Color3.new(0, 0, 0), diff --git a/luau/53878057.luau b/luau/53878057.luau index f0ca04f..3a2bbb6 100644 --- a/luau/53878057.luau +++ b/luau/53878057.luau @@ -3,6 +3,7 @@ print "[Mercury]: Loaded corescript 53878057" local CoreGui = game:GetService "CoreGui" local GuiService = game:GetService "GuiService" +local RunService = game:GetService "RunService" local UserInputService = Game:GetService "UserInputService" -- A couple of necessary functions @@ -525,12 +526,6 @@ local function activateGear(num) end end -local waitForDebounce = function() - while debounce do - wait() - end -end - local function pointInRectangle(point, rectTopLeft, rectSize) if point.x > rectTopLeft.x and point.x < (rectTopLeft.x + rectSize.x) then if @@ -713,7 +708,9 @@ local function addingPlayerChild( addToSlot, inventoryGearButton ) - waitForDebounce() + while debounce do + RunService.Heartbeat:wait() + end debounce = true if child:FindFirstChild "RobloxBuildTool" then @@ -1153,7 +1150,7 @@ pcall(function() Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged) end) -wait() -- let stuff initialize incase this is first heartbeat... +RunService.Heartbeat:wait() -- let stuff initialize incase this is first heartbeat... waitForChild(player, "Backpack") waitForProperty(player, "Character") diff --git a/luau/60595695.luau b/luau/60595695.luau index 9444e8e..be3dc9c 100644 --- a/luau/60595695.luau +++ b/luau/60595695.luau @@ -1,6 +1,8 @@ -- Script Context./Libraries/LibraryRegistration/LibraryRegist print "[Mercury]: Loaded corescript 60595695" +local RunService = game:GetService "RunService" + -- Library Registration Script -- This script is used to register RbxLua libraries on game servers, so game scripts have -- access to all of the libraries (otherwise only local scripts do) @@ -12,7 +14,7 @@ for i = 1, 4 do if ScriptContext then break end - wait(0.2) + RunService.Heartbeat:wait() end if ScriptContext then diff --git a/luau/97188756.luau b/luau/97188756.luau index 19a0d8d..0655cef 100644 --- a/luau/97188756.luau +++ b/luau/97188756.luau @@ -1,12 +1,8 @@ +--!strict -- CoreGui.RobloxGui.CoreScripts/ChatScript print "[Mercury]: Loaded corescript 97188756" ---[[ - //FileName: ChatScript.LUA - //Written by: Sorcus - //Description: Code for lua side chat on Mercury. Supports Scrolling. - //NOTE: If you find any bugs or inaccuracies PM Sorcus on Roblox or @Canavus on Twitter -]] +local RunService = game:GetService "RunService" local SafeChat = require "../Modules/Safechat.yml" -- THANK YOU DARKLUA local New = (require "../Modules/New").New @@ -21,19 +17,13 @@ local function WaitForChild(parent, childName) return parent[childName] end -local function IsPhone() - local cGui = Game:GetService "CoreGui" - local rGui = WaitForChild(cGui, "RobloxGui") - return rGui.AbsoluteSize.Y < 600 -end - -while Game.Players.LocalPlayer == nil do - wait(0.03) +while not Game.Players.LocalPlayer do + RunService.Heartbeat:wait() end local Player = Game.Players.LocalPlayer -while Player.Character == nil do - wait(0.03) +while not Player.Character do + RunService.Heartbeat:wait() end local Camera = Game.Workspace.CurrentCamera @@ -51,7 +41,7 @@ local enum_mt = { end, __index = { GetEnumItems = function(self) - local t = {} + local t: { any } = {} for i, item in pairs(self) do if type(i) == "number" then t[#t + 1] = item @@ -571,9 +561,9 @@ function Chat:CreateMessage(cPlayer, message) end function Chat:ScreenSizeChanged() - wait() + RunService.Heartbeat:wait() while self.Frame.AbsoluteSize.Y > 120 do - self.Frame.Size -= UDim2.new(0, 0, 0.005, 0) + (self.Frame :: Frame).Size -= UDim2.new(0, 0, 0.005, 0) end -- Chat:RecalculateSpacing() end @@ -706,13 +696,6 @@ function Chat:CreateGui() }, } - Spawn(function() - wait(0.5) - if IsPhone() then - self.Frame.Size = UDim2.new(0, 280, 0, 120) - end - end) - self.RenderFrame = self.Frame.ChatRenderFrame if self.Frame.AbsoluteSize.Y > 120 then Chat:ScreenSizeChanged() @@ -861,7 +844,7 @@ function Chat:CullThread() end end end - wait(5.0) + wait(5) end end diff --git a/luau/host.luau b/luau/host.luau index 2a7a35a..7522e66 100644 --- a/luau/host.luau +++ b/luau/host.luau @@ -93,7 +93,7 @@ end) if _MAP_LOCATION_EXISTS then -- yield so that file load happens in the heartbeat thread - wait() + RunService.Heartbeat:wait() -- load the game game:Load(_MAP_LOCATION) diff --git a/luau/join.luau b/luau/join.luau index 269ec6f..ad77375 100644 --- a/luau/join.luau +++ b/luau/join.luau @@ -1,5 +1,6 @@ --!strict print "[Mercury]: Loaded Join corescript" + local InsertService = game:GetService "InsertService" local ChangeHistoryService = game:GetService "ChangeHistoryService" local ContentProvider = game:GetService "ContentProvider" diff --git a/terrain plugins/00 - terrain.luau b/terrain plugins/00 - terrain.luau index 2cc4cf4..a5f4792 100644 --- a/terrain plugins/00 - terrain.luau +++ b/terrain plugins/00 - terrain.luau @@ -1,6 +1,6 @@ -- Local function definitions while game == nil do - wait(1 / 30) + wait() end --------------- diff --git a/terrain plugins/01 - builder.luau b/terrain plugins/01 - builder.luau index 224b0ba..b981b1c 100644 --- a/terrain plugins/01 - builder.luau +++ b/terrain plugins/01 - builder.luau @@ -1,5 +1,5 @@ while game == nil do - wait(1 / 30) + wait() end local ChangeHistoryService = game:GetService "ChangeHistoryService" diff --git a/terrain plugins/02 - remover.luau b/terrain plugins/02 - remover.luau index fd7b307..b46fb1f 100644 --- a/terrain plugins/02 - remover.luau +++ b/terrain plugins/02 - remover.luau @@ -1,5 +1,5 @@ while game == nil do - wait(1 / 30) + wait() end local ChangeHistoryService = game:GetService "ChangeHistoryService" diff --git a/terrain plugins/03 - elevation.luau b/terrain plugins/03 - elevation.luau index 2b93229..4907625 100644 --- a/terrain plugins/03 - elevation.luau +++ b/terrain plugins/03 - elevation.luau @@ -1,5 +1,5 @@ while game == nil do - wait(1 / 30) + wait() end local ChangeHistoryService = game:GetService "ChangeHistoryService" @@ -216,7 +216,7 @@ end -- Show the highlighter. function MouseHighlighter:EnablePreview() - self.selectionBox.Parent = CoreGui-- This will make it not show up in workspace. + self.selectionBox.Parent = CoreGui -- This will make it not show up in workspace. end -- Create the mouse movement highlighter. @@ -625,7 +625,7 @@ function onClicked(mouse2) d = math.floor(50 * (originalY - prevY) / mouse2.ViewSizeY) elevate(x, y, z, elevationOptions.r, r2, d, range) end - wait(0) + wait() end ChangeHistoryService:SetWaypoint "Elevation" end diff --git a/terrain plugins/04 - brush.luau b/terrain plugins/04 - brush.luau index ea2993f..3f3036c 100644 --- a/terrain plugins/04 - brush.luau +++ b/terrain plugins/04 - brush.luau @@ -1,5 +1,5 @@ while game == nil do - wait(1 / 30) + wait() end local ChangeHistoryService = game:GetService "ChangeHistoryService" diff --git a/terrain plugins/06 - craters.luau b/terrain plugins/06 - craters.luau index 7ffc879..c763785 100644 --- a/terrain plugins/06 - craters.luau +++ b/terrain plugins/06 - craters.luau @@ -1,5 +1,5 @@ while game == nil do - wait(1 / 30) + wait() end local ChangeHistoryService = game:GetService "ChangeHistoryService" @@ -80,11 +80,11 @@ function makeCrater(x, y, z, cr, cd) if cellschanged == false then break end - wait(0) + wait() end for ri = 0, cr do - wait(0) + wait() local i = x - ri for k = z - cr, z + cr do diff --git a/terrain plugins/08 - roads.luau b/terrain plugins/08 - roads.luau index 9fb19ce..19c88e1 100644 --- a/terrain plugins/08 - roads.luau +++ b/terrain plugins/08 - roads.luau @@ -1,5 +1,5 @@ while game == nil do - wait(1 / 30) + wait() end local ChangeHistoryService = game:GetService "ChangeHistoryService" diff --git a/terrain plugins/09 - materialpaint.luau b/terrain plugins/09 - materialpaint.luau index 7a69d74..0eac764 100644 --- a/terrain plugins/09 - materialpaint.luau +++ b/terrain plugins/09 - materialpaint.luau @@ -1,5 +1,5 @@ while game == nil do - wait(1 / 30) + wait() end local ChangeHistoryService = game:GetService "ChangeHistoryService" diff --git a/terrain plugins/10 - stamper.luau b/terrain plugins/10 - stamper.luau index c585238..b716af0 100644 --- a/terrain plugins/10 - stamper.luau +++ b/terrain plugins/10 - stamper.luau @@ -1,5 +1,5 @@ while game == nil do - wait(1 / 30) + wait() end --------------- diff --git a/terrain plugins/11 - floodfill.luau b/terrain plugins/11 - floodfill.luau index 6e52abc..703f7b9 100644 --- a/terrain plugins/11 - floodfill.luau +++ b/terrain plugins/11 - floodfill.luau @@ -1,5 +1,5 @@ while game == nil do - wait(1 / 30) + wait() end local ChangeHistoryService = game:GetService "ChangeHistoryService"