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

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

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.

Points_To_Give = 100  -- Player Points that will be given.

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and game:GetService("PointsService"):GetAwardablePoints() > Points_To_Give - 1 then
        local P = game.Players:GetPlayerFromCharacter(hit.Parent)
        if not P:FindFirstChild("Has Been Given " .. Points_To_Give) then
            game:GetService("PointsService"):AwardPoints(P.userId, Points_To_Give)
            Marker = Instance.new("Flag", P)
            Marker.Name = "Has Been Given " .. Points_To_Give
        end
    end
end)

1 answer

You have:

Points_To_Give = 100  -- Player Points that will be given.

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and game:GetService("PointsService"):GetAwardablePoints() > Points_To_Give - 1 then
        local P = game.Players:GetPlayerFromCharacter(hit.Parent)
        if not P:FindFirstChild("Has Been Given " .. Points_To_Give) then
            game:GetService("PointsService"):AwardPoints(P.userId, Points_To_Give)
            Marker = Instance.new("Flag", P)
            Marker.Name = "Has Been Given " .. Points_To_Give
        end
    end
end)

I would rather do this:

Points_To_Give = 100  -- Player Points that will be given.

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and game:GetService("PointsService"):GetAwardablePoints() > Points_To_Give  then
        local P = game.Players:GetPlayerFromCharacter(hit.Parent)
            game:GetService("PointsService"):AwardPoints(P.userId, Points_To_Give)
        end
    end
end)

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

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