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

How do I award player points at the end of an obby?

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)

2 answers

What I would do is add a Value in the Player.

game.Players.PlayerAdded:connect(function(player)
	int = Instance.new("BoolValue")
	int.Name = "Finished"
	int.Parent = player
	int.Value = false
end --Put this in Workspace...

Then you do the script that awards the points:

script.Parent.Touched:connect(function(player) --Part Touched, calls player
	int = hit.Parent:FindFirstChild("Finished") --Checks for BoolValue
	if int ~=nil and int.Value == false then --Checks if the BoolValue is there and if it's false
		game:GetService("PointsService"):AwardPoints(player.userId,100) --Awards 100 Points
		int.Value = true --Avoids another 100PP's
	end
	wait(1) --Waits 1 second before giving another 100PPs if they haven't got them yet
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

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