Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I stop a GUI from reseting when a player resets?

So I have a textbutton that uses on click to give 1 point every 3 seconds:

function onClick()
	if game.Players.LocalPlayer.leaderstats.Score.Value >= 100 then
	script.Parent.Visible = false
	while true do
        game.Players.LocalPlayer.leaderstats.Score.Value = game.Players.LocalPlayer.leaderstats.Score.Value + 1
        local str =  game.Players.LocalPlayer.leaderstats.Score.Value
        local str1 = "Your income: "
        game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Cashincome.Text = str1..str
     
wait(3)	
	end
    end
end
script.Parent.MouseButton1Click:connect(onClick)

This works great but when I reset it stops the while loop and makes the GUI visible again. How do I stop it from doing this?

2 answers

✓ Accepted answer

You might need this:

game:GetService("StarterGui").ResetPlayerGuiOnSpawn = false

You can do this in studio too, so it is disabled by default.

1 comment

0

Thank you. I can now make progress again.

Using this property of StarterGui.

I'm not sure if the HealthGUI problem still applies. I'll look into it and edit the page. EDIT: It does not.

This discussion is preserved as it was. New answers, comments, and votes are closed.