Sometimes when I load my game my bootup script runs before the reset button

I want to know how to make it so the script waits for the reset button to load and then disable it.

Right now if the script loads before the reset button then it crashes the entire script which breaks my map loading code as well which means I just stay in my test map.

Strangely this only happens in roblox beta player

Script

--Variables
local player = game.Players.LocalPlayer
local GUI = player:WaitForChild('PlayerGui'):WaitForChild('ScreenGui', math.huge)
local bootup = GUI.boot_up_screen
local main_menu = GUI.main_menu
local children = game.Workspace.maps:GetChildren()
local loaded_map = script.Parent.loaded_map
local Blur = game.Lighting.Blur
local functions = require(game.Players.LocalPlayer.PlayerScripts.local_functions);

game.StarterGui:SetCore('ResetButtonCallback', false)
GUI.boot_up_screen.Visible = true
GUI.main_menu.Visible = true
	
	for i = 1, #children do
		local child = children[i]
		
		if child:IsA("Folder") then
			child.Parent = game.ReplicatedStorage.local_map_storage
			loaded_map.Value = "none"
		end
		end
		
		game.ReplicatedStorage.local_map_storage.none.Parent = game.Workspace.maps
		
		functions.load_map("default_bunker", 40.659, -24.339, -558.835, 0,-180,0, false, "Test Map 1", "Do not enter unless told to do so otherwise you will pay", Color3.new(255,255,255))

wait (2)

for i = 0,20,1 do
	bootup.TextLabel.TextTransparency = bootup.TextLabel.TextTransparency + 0.05
	wait (0.01666666666)
end

wait (0.1)

for i = 0,10,1 do
	bootup.Transparency = bootup.Transparency + 0.1
	wait (0.01666666666)
end
	
	wait(0.5)
	
----show the menu------

main_menu.show_menu.Value = true

Blur.Enabled = true

for i = 0,12,1 do
	Blur.Size = Blur.Size + 1
	wait (0.01666666666)
end

Try putting the script in StarterCharacter scripts. Doing this works for me

What exactly does putting it in startercharacterscripts do?

It makes it run when the character spawns. For some reason this works for me

Idk i would have to change a lot of variables. I might as well put a wait and also I need my splash screen to load as soon as possible and no, I’m not putting my splash screen in replicated first as I want the roblox loading screen to stay. I’m gonna wait until someone shows me how to idk wait until the reset button has loaded.

You can connect to a CharacterAdded event and disconnect it when it fires to Not make unecessary calls to :SetCore()

It’s not necessary to make a LocalScript in the StarterCharacter scripts or connect it to the CharacterAdded event.
There’s a few methods to combat this, one would be quite simply putting a wait before setting the ResetCallback. Another one which I will provide the code for is to brute force (?) the ResetCallback.
What I mean by this is repeating the call until it works.
The code for it would look something like this:

local StarterGui = game:GetService("StarterGui")
local RunService = game:GetService("RunService")
repeat
	RunService.Heartbeat:Wait()
until pcall(StarterGui.SetCore, StarterGui, "ResetButtonCallback", false)
1 Like

Tried this out finally and it is now 100% reliable now.

1 Like