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

scripting trouble: script where if someone dies then everyone dies?

Asked by 4 years ago

i learned how to make a script for a brick to kill you... but i’m having trouble to make it where if someone dies then everyone dies and respawns, so how do i do it or how do i start off? any help is appreciated!

2 answers

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

I would advise you look into the Player.CharacterAdded event, the Humanoid.Died event, and the Players.PlayerAdded event. You can use these to help detect when someone has died.

Ad
Log in to vote
0
Answered by
qVoided 221 Moderation Voter
4 years ago

**Put a local script into StarterGui: **

wait()

local player = game.Players.LocalPlayer
local chr = player.Character
local humanoid = chr:WaitForChild("Humanoid")

humanoid.Died:Connect(function()
    for i,v in pairs(game.Players:GetPlayers()) do
        v.Character:WaitForChild("Humanoid").Health = 0
    end
end)

Hope this helps!

0
it sadly didn't work :( i appreciate it though, i'll have to find out some way. valentina1023 0 — 4y
0
Did you put a local script into the starter gui? qVoided 221 — 4y

Answer this question