Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
4

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

Asked by
NecoBoss 194
11 years ago

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

01function onClick()
02    if game.Players.LocalPlayer.leaderstats.Score.Value >= 100 then
03    script.Parent.Visible = false
04    while true do
05        game.Players.LocalPlayer.leaderstats.Score.Value = game.Players.LocalPlayer.leaderstats.Score.Value + 1
06        local str =  game.Players.LocalPlayer.leaderstats.Score.Value
07        local str1 = "Your income: "
08        game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Cashincome.Text = str1..str
09 
10wait(3)
11    end
12    end
13end
14script.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

Log in to vote
4
Answered by
Lacryma 548 Moderation Voter
11 years ago

You might need this:

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

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

0
Thank you. I can now make progress again. NecoBoss 194 — 11y
Ad
Log in to vote
3
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
11 years ago

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.

Answer this question