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

How to make a part that gives stuff from a leader bored?

Basically When you touch a part it will give you Money

game.Players.PlayerAdded:connect(function(p)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"
	stats.Parent = p
	
	local money = Instance.new("IntValue")
	money.Name = "Strength" 
	money.Value = 0
	money.Parent = stats
end		

There is my script hope somebody can Help me with this

1 answer

You got the leaderboard ready. Now create a brick and insert script inside it and type this:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)

		player.leaderstats.Strength.Value += 5 -- You can change 5 to the amount you want to give.
	end
end)

Hope it helps

2 comments

0

Ok i have 2 leaderboard's Coins and Strength. When you touch a part it will reset your Strength but give u the same amount of coins u have.

0

So you mean it wont change your coins only it will make your strength back to 0?

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