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

How would I make a script that makes a player respawn every _ seconds? [closed]

Asked by 6 years ago

I'm new at coding, I know very little on how to code but I have been able to create some simple scripts (walkspeed, map changing, instant respawn) so far. However I'm having trouble finding info on how to make a player respawn automatically every _ seconds. I need to do this because in the midst of map changing the player falls into the void and dies. Thanks!

0
Alternatively instead of respawning them constantly, you can teleport them to a game lobby or respawn them in one until the new map loads. Troidit 253 — 6y

Closed as Not Constructive by farrizbb, DeceptiveCaster, Amiaa16, Troidit, cmgtotalyawesome, User#20388, Programical, and minikitkat

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

3 answers

Log in to vote
1
Answered by 6 years ago

Use a loop (http://wiki.roblox.com/index.php?title=Loops) Here's an example.

while wait(5) do
    game.Players.Player1:LoadCharacter()
end
Ad
Log in to vote
1
Answered by 6 years ago
local player = "mamaluigi1234" -- Change to the name of the player
local seconds = 60 -- Change to how many seconds between respawns

while true do
    wait(seconds)
    if game.Players[player] then
        game.Players[player]:LoadCharacter()
    end
end
0
if game.Players[player] would error if the player left the game. Amiaa16 3227 — 6y
Log in to vote
0
Answered by 6 years ago
game.Players.PlayerAdded:Connect(function(player)
    while wait(5) do -- changed 5 to whatever time you need
        player:LoadCharacter()
    end
end)