I've been trying for the last two days to come up with an effective script that will make it rain bricks with PP in them. I've used multiple scripts but they all don't work correctly. What I need is a script inside the brick that when it touches the ground it will disappear in 2 seconds but if someone touches it before that then they will be rewarded with 3 player points, then it will be destroyed. Yes I do have player points in the server.
Most recent failed script:
local PointsService = game:GetService("PointsService")
local db = false
function onTouched(hit)
if (not hit.Parent:FindFirstChild("Humanoid")) or db then return end
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if PointsService:GetAwardablePoints() <= 2 then script.Parent:Destroy() end
db = true
PointsService:AwardPoints(player.userId, 3)
wait(2)
script.Parent:Destroy()
end
end
script.Parent.Touched:connect(onTouched)

1 comment
Help?