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

Leaderboard point issues. So how do I do this?

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?

1 answer

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

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