I am trying to make a currency pickup system.
When I were to touch the object, it should increase the leaderboard value for the player's coins via leaderstats, but it doesn't. I did not receive any error messages, so I am completely left in the dark.
The following code is in a local script.
coin = script.Parent
coin.Touched:Connect(function(player)
if coin.AlreadyCollected.Value == false then
local LocalPlayer = game.Players.LocalPlayer
local gold = LocalPlayer.leaderstats.Gold.Value
gold = gold + 1
end
end)
Any help will be appreciated! :)

1 comment
"player" comes from your touched object btw