Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

Log in to vote
0
Answered by
Soban06 410 Moderation Voter
3 years ago

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

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. Totallynot_Zenta 1 — 3y
0
So you mean it wont change your coins only it will make your strength back to 0? Soban06 410 — 3y
Ad

Answer this question