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

How would you tell when a player is like.. not dead?

Humanoid.Died:connect(function()
			if _G.CombatReady then
				local character = Humanoid.Parent
				bot:WaitForChild("Control").Disabled = true
				bot:WaitForChild("Humanoid").Health = 100
				repeat wait() until Player.Character
				character:MoveTo(CombatSpawn.Position)
				local mar = Player:WaitForChild("PlayerGui"):WaitForChild("Notes"):WaitForChild("ribbert")
				mar:TweenPosition(UDim2.new(0.5, -150, 0.5, -75), "Out", "Sine", 0.5)
			end
			_G.CombatReady = false -- even if it was already false

The purpose of the script is that when a player dies from a bot, it heals the bot and it's > supposed < to teleport them back but the problem I am experiencing is that after the Humanoid dies, it teleports the player before they've even respawned yet.

Basically, I need a way to make sure that it checks if the player has respawned before it does all this stuff.

2 comments

0

I just did Player:LoadCharacter() right after the Humanoid dies but if anybody has a different and hopefully more efficient solution, please post!

0

Just put "wait(5.5)" where you want to wait for the player to respawn. That's about the time it takes to respawn.

1 answer

Check if the player health is anything but 0, if it is, then they is alive. If not, they is dead.

1 comment

0

New to scripting but I think you do it like =~

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