Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how can i make this piece of code loop all the time instead of once?

Asked by
Jumbuu 110
8 years ago
game.Players.PlayerAdded:connect(function(player)
    print(player.Name.." ".."has joined")
    repeat wait() until player.Character.Head
    player.Character.Humanoid.Died:connect(function()
        print(player.Name.." ".."has died")
    end)

end)

2 answers

Log in to vote
1
Answered by 8 years ago

Use "While true do"

Ad
Log in to vote
3
Answered by
LostPast 253 Moderation Voter
8 years ago
game.Players.PlayerAdded:connect(function(player)
    print(player.Name.." ".."has joined")
    player.CharacterAdded:connect(function(char) --fires every time the player respawns.
    print(player.Name.." ".."has spawned")
        char.Humanoid.Died:connect(function()
            print(player.Name.." ".."has died")
        end)
    end)
end)
0
thanks, i never knew abou the character added function and that it fires every time a player spawns Jumbuu 110 — 8y
0
Same. User#11440 120 — 8y

Answer this question