I have a points/money system in my leaderboard, and I would like to know how to make a part award the player that touches it to gain a "point" in the leaderboard.
How would I do this?
Thank you.
I have a points/money system in my leaderboard, and I would like to know how to make a part award the player that touches it to gain a "point" in the leaderboard.
How would I do this?
Thank you.
script.Parent.Touched:connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
player = game.Players:GetPlayerFromCharacter(hit.Parent)
player:FindFirstChild("leaderstats").Points.Value = player:FindFirstChild("leaderstats").Points.Value + 1
end
end)
I fixed it, you're welcome!
Want it to wait before it can be used again? Here
script.Parent.Touched:connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
player = game.Players:GetPlayerFromCharacter(hit.Parent)
player:FindFirstChild("leaderstats").Points.Value = player:FindFirstChild("leaderstats").Points.Value + 1
script.Disabled = true
wait(5) --Change 5 to anything
script.Disabled = false
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
16 comments
It didn't, but thank you for answering!
I fixed it.
Haha, I caught that mistake! Thank you so much!
You're welcome! Tell me if you need anything else. I am free to help!
Actually- I do.. is there anyway I could limit the amount of points given to one? Is it a wait function?
Yes. You have to use wait. Though also if you want it to stop it if it is above a certain number then the script Disables
Where would I put the wait function?
Just put it before the last end then it will wait until it can be used again.
Okay never mind. Here!
It didn't work. I tried "wait(4)" before the last end, after the last end.. the part kept rewarding points.
Oh hold on
Okay.
Ah, that last edit fixed it. Thank you so much for your time! I'll keep you in mind if I need anything!
Okay.
The problem with that is that once the script is disabled, other players will not be able to gain points(unless that is what he wants). There is a better way.
I know. You have also use the Local Camera where you'll have to wait until the Local Player can see the brick again.