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
I just did Player:LoadCharacter() right after the Humanoid dies but if anybody has a different and hopefully more efficient solution, please post!
Just put "wait(5.5)" where you want to wait for the player to respawn. That's about the time it takes to respawn.