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

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

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.

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

no error pops up it just doesnt work

1 answer

local money=game.Players.LocalPlayer.leaderstats.money.Value -- Forgot the .Value <3
local part=game.workspace.MoneyCollector
part.Touched:Connect(function(hit)
    if hit.name=="MoneyPart" then
        money.Value=money.Value+5
    end
end)

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

1 comment

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

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