I have been trying to use this code in my game to award player points if someone does not die for 5 seconds, but it wont work.
-- declare service
local PointsService = Game:GetService("PointsService")
-- Bind function to player added event
game.Players.PlayerAdded:connect(function(player)
-- Get total number of points this game has already awarded to the player
local universeBalance = PointsService:GetGamePointBalance(player.userId)
-- Check if the player has died. If true, don't award points for 10 seconds. If false, award points every 5 seconds
while true do
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
if character:WaitForChild("Humanoid").Died:connect(function()
end)
then
wait(10)
else
wait(5)
PointsService:AwardPoints(player.userId, 1)
end
end)
-- Bind function to when points are successfully awarded
PointsService.PointsAwarded:connect(function(userId, userBalanceinUni, userBalance)
end)
I would love it if your could help. Thanks!
