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

How to restart game if the main player (Seeker) dies?

Hi im making a hide and seek game and the problem i came upon is the game doesnt reset when the seeker dies or disconnects

I have decided to put it in the seeker's script, not the main game script. (Along with the when the seeker touches a player, the player dies.)

I am having trouble with the function to make it so, if the choosen seeker dies or disconects, the game restarts.

Any help?

This is what i have came up with.

function onDead(Char)
					local owner = game.Players:findFirstChild(script.owner.Value)
						if owner ~= nil then
EndGame()
end
owner:WaitForChild("Humanoid").Died:connect(onDead)

1 answer

I have changed it into this instead,

local owner = game.Players:findFirstChild(script.owner.Value)

function onDead(Char)
	EndGame()
		end
end
owner.Died:connect(onDead)

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