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?
You might need this:
game:GetService("StarterGui").ResetPlayerGuiOnSpawn = false
You can do this in studio too, so it is disabled by default.