diff --git a/CoreScriptsRoot/CoreScripts/Topbar.lua b/CoreScriptsRoot/CoreScripts/Topbar.lua index b3f1b9fe..284e5a82 100644 --- a/CoreScriptsRoot/CoreScripts/Topbar.lua +++ b/CoreScriptsRoot/CoreScripts/Topbar.lua @@ -18,8 +18,10 @@ local newNotificationPath = getNewNotificationPathSuccess and newNotificationPat local newChatVisiblePropSuccess, newChatVisiblePropValue = pcall(function() return settings():GetFFlag("ChatVisiblePropertyEnabled") end) local newChatVisibleProp = (newChatVisiblePropSuccess and newChatVisiblePropValue) ---[[ END OF FFLAG VALUES ]] +local resetButtonFlagSuccess, resetButtonFlagValue = pcall(function() return settings():GetFFlag("AllowResetButtonCustomization") end) +local resetButtonCustomizationAllowed = (resetButtonFlagSuccess and resetButtonFlagValue == true) +--[[ END OF FFLAG VALUES ]] --[[ SERVICES ]] @@ -34,6 +36,12 @@ local TextService = game:GetService('TextService') --[[ END OF SERVICES ]] +-- Register SetCore functions early +local earlyResetCallbackValue = nil +if resetButtonCustomizationAllowed then + StarterGui:RegisterSetCore("ResetButtonCallback", function(value) earlyResetCallbackValue = value end) +end + --[[ MODULES ]]-- local GuiRoot = CoreGuiService:WaitForChild('RobloxGui') local TopbarConstants = require(GuiRoot.Modules.TopbarConstants) @@ -53,8 +61,8 @@ if defeatableTopbar then end end) end -local lookMenuEnabled = true +local lookMenuEnabled = true local settingsActive = false local GameSettings = UserSettings().GameSettings @@ -939,6 +947,10 @@ end local function CreateSettingsIcon(topBarInstance) local MenuModule = require(GuiRoot.Modules.Settings.SettingsHub) + if earlyResetCallbackValue ~= nil then + MenuModule:SetResetButtonCallback(earlyResetCallbackValue) + end + local settingsIconButton = Util.Create'ImageButton' { Name = "Settings"; diff --git a/CoreScriptsRoot/Modules/Settings/SettingsHub.lua b/CoreScriptsRoot/Modules/Settings/SettingsHub.lua index 052dce85..16e797be 100644 --- a/CoreScriptsRoot/Modules/Settings/SettingsHub.lua +++ b/CoreScriptsRoot/Modules/Settings/SettingsHub.lua @@ -378,23 +378,30 @@ local function CreateSettingsHub() end end + local function resetCustomizationFunc(callback) + local isBindableSuccess, isBindableValue = pcall(function() return type(callback) == "userdata" and callback:IsA("BindableEvent") end) + local isBindable = (isBindableSuccess and isBindableValue) + if isBindable or type(callback) == "boolean" then + this.ResetCharacterPage:SetResetCallback(callback) + else + warn("ResetButtonCallback must be set to a BindableEvent or a boolean") + end + + if callback == false then + setResetEnabled(false) + elseif not resetEnabled and (isBindable or callback == true) then + setResetEnabled(true) + end + end + + function this:SetResetButtonCallback(value) + resetCustomizationFunc(value) + end + if resetButtonCustomizationAllowed then - StarterGui:RegisterSetCore("ResetButtonCallback", function(callback) - local isBindableSuccess, isBindableValue = pcall(function() return type(callback) == "userdata" and callback:IsA("BindableEvent") end) - local isBindable = (isBindableSuccess and isBindableValue) - if isBindable or type(callback) == "boolean" then - this.ResetCharacterPage:SetResetCallback(callback) - else - warn("ResetButtonCallback must be set to a BindableEvent or a boolean") - end - if callback == false then - setResetEnabled(false) - elseif not resetEnabled and (isBindable or callback == true) then - setResetEnabled(true) - end - end) + StarterGui:RegisterSetCore("ResetButtonCallback", resetCustomizationFunc) end - + -- Xbox Only local inviteToGameFunc = function() local platformService = game:GetService('PlatformService') @@ -1246,6 +1253,10 @@ function moduleApiTable:HideShield() SettingsHubInstance:HideShield() end +function moduleApiTable:SetResetButtonCallback(value) + SettingsHubInstance:SetResetButtonCallback(value) +end + moduleApiTable.SettingsShowSignal = SettingsHubInstance.SettingsShowSignal moduleApiTable.Instance = SettingsHubInstance