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

Is it possible to make all the dead people respawn at the same time?

Asked by 4 years ago

When someone dies, it puts them in a queue with other dead people until the respawn timer goes down, and when that happens the dead players respawn at the same time.

0
What I have learned over the years, everything is possible if you have faith and try hard. It might not be easy, it can be extremely hard, but in Roblox, it is possible to do anything from your wildest dreams. Powering imagination, right? (Have no idea why I wrote this) Torren_Mr 334 — 4y
0
@Torren Oof Igoralexeymarengobr 365 — 4y
0
@Torren_Mr ok Dovydas1118 1495 — 4y
0
@minerpepper try using an in pairs loop. Dovydas1118 1495 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Yes, let me write a simple example for you.

--run this after some time you expect to some or all players be dead.
for _,v in pairs(game:GetService("Players"):GetPlayers()) do
    if v.Character and v.Character.Humanoid.Health == 0 then
        v:LoadCharacter()
    end
end

you may want to disable CharacterAutoLoads or increase the respawn delay by a large number. Heres a example from Developer Forum: Link

0
Would this go in SSS? minerpepper 18 — 4y
0
Server script service* minerpepper 18 — 4y
Ad
Log in to vote
0
Answered by
DevingDev 346 Moderation Voter
4 years ago

I'll write a little bit of pseudo code for you. Now this won't contain everything, but should be enough for a basic understanding.

listen to player died event, add player to queued players table, listen to round ended event, loop through all players and respawn them.

You're pretty much adding the players to a table and looping through that table with pairs when the round has ended or whenever you need them to respawn.

Answer this question