Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would i make this work everytime the player respawns?

I have this script

game:GetService('Players').PlayerAdded:connect(function(player)
if player:FindFirstChild("Points") ~= nil then
if player.Points.Value > 0 and player.Points.Value <= 40 then
player.leaderstats.Rank.Value = "Private"
elseif player.Points.Value > 40 and player.Points.Value <= 100 then
player.leaderstats.Rank.Value = "General"
end
end
end)

but it only works when the player enters the game for the first time, so how would I make it work everytime the player respawns?

1 answer

✓ Accepted answer

You would need to use the function built into the player, .CharacterAdded, here is an example:

game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function()--Added function
if player:FindFirstChild("Points") ~= nil then
if player.Points.Value > 0 and player.Points.Value <= 40 then
player.leaderstats.Rank.Value = "Private"
elseif player.Points.Value > 40 and player.Points.Value <= 100 then
player.leaderstats.Rank.Value = "General"
end)--Added end
end
end
end)

This should work, if it does, or helps you, could you accept the answer? It gives us both rep!

This discussion is preserved as it was. New answers, comments, and votes are closed.