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

How to add values on a leader board in a tycoon?

Asked by
emrek 7
5 years ago

I am trying to make a script that adds 5 to a players money everytime it hits a part called Money collector. The script is a local script and it is in StarterCharacterScripts.

1local money=game.Players.LocalPlayer.leaderstats.money
2local part=game.workspace.MoneyCollector
3part.Touched:Connect(function(hit)
4    if hit.name=="MoneyPart" then
5        money.Value=money.Value+5
6    end
7end)

no error pops up it just doesnt work

1 answer

Log in to vote
0
Answered by 5 years ago
1local money=game.Players.LocalPlayer.leaderstats.money.Value -- Forgot the .Value <3
2local part=game.workspace.MoneyCollector
3part.Touched:Connect(function(hit)
4    if hit.name=="MoneyPart" then
5        money.Value=money.Value+5
6    end
7end)

~ SinfullyLucky#7153 ????????????

0
if you look at my original code I didn't have ".Value" in the variable but put it in later when I added +5 emrek 7 — 5y
Ad

Answer this question