How do I make it so when a player touches a brick, it gives them gold? here is my leaderboard script by the way:
function playerAdded(plr) local stats = Instance.new("IntValue", plr) stats.Name = "leaderstats" local cash = Instance.new("IntValue", stats) cash.Name = "Gold" cash.Value = 50 end game.Players.PlayerAdded:connect(playerAdded)
Also, how do I make it so when a player also touches a brick, it takes away gold?
local howMuchGold = 50 part.Touched:connect(function(part) local plr = game.Players:GetPlayerFromCharacter(part.Parent) if plr then plr.leaderstats.Gold.Value = plr.leaderstats.Gold.Value + howMuchGold end end)
If you want it to decrease then make howMuchGold negative