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

Can someone help me with a Player Point Giver Brick that can only be taken 1 time every life?

Asked by 9 years ago

I am making a game that awards Player Points when you get to a certain platform but, I don't want people waiting at that one platform and keep on getting the player points. Here is what I have that doesn't protect that.

local PointsService = game:GetService("PointsService")

local db = false
local dbTime = 6

script.Parent.Touched:connect(function(hit)
if not hit.Parent:FindFirstChild("Humanoid") or db then return end
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
db = true
PointsService:AwardPoints(player.userId, 6)
wait(dbTime)
db = false
end
end)

Answer this question