When I play my game all the PP gets stacked up and never deletes. How do you fix it? I have the script inside a brick and when you touch it, it gives you 3 player points.
local PointsService = game:GetService("PointsService")
local db = false local dbTime = 3
function onTouched(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, 3) wait() wait(2) script.Parent:Destroy() db = false end end
script.Parent.Touched:connect(onTouched)

5 comments
No one?
Help!!
helphelphelphelphelphelphelphelphelphelphelp!!!!!!!!!!!!!!!!!!
What is wrong here? Could you elaborate further?
I want the brick in lighting called "PP" to be cloned and spawned randomly across the map and when they are touched, they are destroyed but not away. But if they're still on the ground and someone touches it they are given 3 player points. But since this is the script inside PP I just want it to give PP when touched by a player and destroyed after 2 seconds of being touched.