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

Scripting Help? (Easy)

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Im just getting into scripts and I have this Gui tycoon (located in StarterGuis) for collecting cash and.. For some reason every time you reset, The cash goes back down to 0. Can anyone please help? Thanks!

This is the script

function oc()
script.Parent.Parent.Money.Value = script.Parent.Parent.Money.Value + script.Parent.Parent.Collect.Value
script.Parent.Parent.Collect.Value = 0
end
script.Parent.MouseButton1Down:connect(oc)

1 answer

Log in to vote
4
Answered by
DataStore 530 Moderation Voter
8 years ago

I'm guessing that the 'Money' value is in the player's PlayerGui? If so, the reason this is occurring is because when a player respawns their PlayerGui is cleared and replaced with what's in StarterGui.

To fix the issue you've come across, either move the 'Money' value to the player's player object, in the Players service - Or prevent their PlayerGui from resetting by toggling the "ResetPlayerGuiOnSpawn" property of StarterGui.

0
Thank you so much! Iv been trying for days to fix it x3 AwryScott 10 — 8y
Ad

Answer this question