Hello, I am making an obby that awards 100 player points for each time you win. I have the scripts prepared (Death, Change Team, and Award Player Points) but the problem is, everytime you step on the button at the end, it awards the player a ton of times worth 100 player points each time it awards the player. It has awarded me up to 14 times each time I use it but it usually remains in the 5 - 10 range. How can I make it only award the user ONE time? The script is below.
Script:
points = game:getService("PointsService")
script.Parent.Torso.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil then player = game.Players:GetPlayerFromCharacter(hit.Parent) if player ~= nil then a = points:GetAwardablePoints() Value = script.Parent.PP if a >= Value.Value then wait() points:AwardPoints(game.Players:GetPlayerFromCharacter(hit.Parent).userId, Value.Value) else end end end end)
What I would do is add a Value in the Player.
1 | game.Players.PlayerAdded:connect( function (player) |
2 | int = Instance.new( "BoolValue" ) |
3 | int.Name = "Finished" |
4 | int.Parent = player |
5 | int.Value = false |
6 | end --Put this in Workspace... |
Then you do the script that awards the points:
1 | script.Parent.Touched:connect( function (player) --Part Touched, calls player |
2 | int = hit.Parent:FindFirstChild( "Finished" ) --Checks for BoolValue |
3 | if int ~ = nil and int.Value = = false then --Checks if the BoolValue is there and if it's false |
4 | game:GetService( "PointsService" ):AwardPoints(player.userId, 100 ) --Awards 100 Points |
5 | int.Value = true --Avoids another 100PP's |
6 | end |
7 | wait( 1 ) --Waits 1 second before giving another 100PPs if they haven't got them yet |
8 | end --Put this in the part that gets touched |
If there are any errors Please tell me (They might be Typos, Please provide the Output)
before you can give player player points you need a group with a clan make the game a group game than can you give player points away