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

How can I award ONE bulk of 100 player points at the end of an obby?

Asked by
Retroc 35
10 years ago

Hiya all! I have a new obby that I am making that awards 100 player points at the end of the obby. You press a button at the end of the obby that has 2 other scripts in it to kill the player and move the player to the first stage (Which is a team). I have received a lot of help so far, and I feel really close to solving this. As of right now, this problem is whenever you press this button, it awards a lot of bulk 100 player points. So it can award up to 1000 player points which is so annoying. There is only one script right now, meaning there isn't another script in the Workspace that gives that player a value or anything. The part you press to get the player points is called "PointsAwarder" in case that is needed.

This is the script located in PointsAwarder.

01Points_To_Give = 100  -- Player Points that will be given.
02 
03script.Parent.Touched:connect(function(hit)
04    if hit.Parent:FindFirstChild("Humanoid") and game:GetService("PointsService"):GetAwardablePoints() > Points_To_Give - 1 then
05        local P = game.Players:GetPlayerFromCharacter(hit.Parent)
06        if not P:FindFirstChild("Has Been Given " .. Points_To_Give) then
07            game:GetService("PointsService"):AwardPoints(P.userId, Points_To_Give)
08            Marker = Instance.new("Flag", P)
09            Marker.Name = "Has Been Given " .. Points_To_Give
10        end
11    end
12end)

1 answer

Log in to vote
0
Answered by 10 years ago

You have:

01Points_To_Give = 100  -- Player Points that will be given.
02 
03script.Parent.Touched:connect(function(hit)
04    if hit.Parent:FindFirstChild("Humanoid") and game:GetService("PointsService"):GetAwardablePoints() > Points_To_Give - 1 then
05        local P = game.Players:GetPlayerFromCharacter(hit.Parent)
06        if not P:FindFirstChild("Has Been Given " .. Points_To_Give) then
07            game:GetService("PointsService"):AwardPoints(P.userId, Points_To_Give)
08            Marker = Instance.new("Flag", P)
09            Marker.Name = "Has Been Given " .. Points_To_Give
10        end
11    end
12end)

I would rather do this:

1Points_To_Give = 100  -- Player Points that will be given.
2 
3script.Parent.Touched:connect(function(hit)
4    if hit.Parent:FindFirstChild("Humanoid") and game:GetService("PointsService"):GetAwardablePoints() > Points_To_Give  then
5        local P = game.Players:GetPlayerFromCharacter(hit.Parent)
6            game:GetService("PointsService"):AwardPoints(P.userId, Points_To_Give)
7        end
8    end
9end)

You don't really need a flag Marker. I hope this works. If it doesn't, tell me what you see in output...

Ad

Answer this question