Force respawn script

Is there a script that exists that is compatible for DarkRP to force respawn people? This is the closest thing I could find: though if a player respawns before they are spawned, then they get teleported back to their spawn point.

I did try messing around with the script to check if the player was alive or not, though it did not work.

Post your code with the alive check.

hook.Add("PlayerDeath", "meme", function(ply)
    ply.SpawnAt = CurTime() + 5 //amount of seconds

hook.Add("PlayerDeathThink", "meme2", function(ply)
    if(CurTime() > ply.SpawnAt) then ply:Spawn() end


GM:PlayerDeathThink. You can’t call spawn manually, just return true.

Odd considering it works fine for me. Spawn is also called in sandbox in this hook iirc.

I believe the return value is whether they can click to manually respawn or not.

You’re right, you just need to return false if you’re not spawning them to prevent them from clicking to respawn.

I found another script before all these posts come up, thanks for help though!

If anyone is interested on the script that I used, original post:

My edit:

if CLIENT then return end

if SERVER then
function RespawnWow(ply)
	ply:ScreenFade( SCREENFADE.OUT, Color( 0, 0, 0, 255 ), 3, 5 ) --Fade out screen to black over 3 seconds and stay black for another two until user respawns.
	--if you change the respawn timer make sure to change the last number value on fadeout, or remove the screenfade completely if you don't want the screen to fade to black
	timer.Simple(5, function() --Number of seconds until force respawned
		if ply:Alive() then --If player respawns before auto respawn does it, it will reset the timer
			ply:Spawn()  --Spawns the player is not already spawned

hook.Add( "PlayerDeath", "RespawnWow", RespawnWow )