basicly I made this script so that when a player touch the part he gets 2 points and respawns at sime time but I was wondering how I could make the script so that when the player respawns he can get 2 more points again
waittime = 1
amnt = 2
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Points")
if (score~=nil) then
score.Value = score.Value + amnt
end
end
end
script.Parent.Transparency = 0
script.Disabled = true
wait(waittime)
script.Parent.Transparency = 0
script.Disabled = true
end
end
script.Parent.Touched:connect(onTouched)
script.Parent.Touched:connect(function(Hit)
Player = Game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
Player:LoadCharacter()
end
end)
