How Would I Make a Player Death Counter?

I’m trying to make a counter when they player is killed it waits 15 seconds and then the player can start moving again, this is what I have at the moment and its not exactly what I wanted. (I also have an animation I want to play which I haven’t made yet)

https://drive.google.com/file/d/1rMf5SzTivrf7gzdW0SJip9Am2CGozD01/view?usp=sharing

Heres the server script i have atm

game.Players.PlayerAdded:Connect(function(player) -- Player added function for player variable
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		humanoid.BreakJointsOnDeath = false -- Disables players character falling apart on death
		
		humanoid.Died:Connect(function() -- Clone GUI when died
			local countdownGui = script.CountdownGui
			local clone = countdownGui:Clone()
			clone.Parent = character:FindFirstChild("Head") -- Clones too head
			
			-- Timer
			local waitTime = game.Players.RespawnTime
			
			repeat
				wait(1)
				waitTime = waitTime - 1
				clone.Countdown.Text = waitTime.."s"
			until waitTime == 0
			clone:Destroy()
			game.ReplicatedStorage.Events.PlayerRespawned:FireClient(player)
			humanoid.WalkSpeed = 20
		end)
	end)
end)

Can you tell us what you would like to improve, so we have an idea of what you want to achieve?

Well the script I’ve made respawns them back at the spawn after the timer is done, I want them to stay where they were when the timer finishes

What are you doing currently to respawn the player? Can we see the other side of your PlayerRespawn event?

Couldn’t you respawn them using LoadCharacter, and then instantly reset their HumanoidRootPart’s CFrame back to where it was previously?

How would I implement this into my script?

After the section after the while loop runs out of time, you could do something like this:

HRPCFrame = character.HumanoidRootPart.CFrame

player:LoadCharacter()
character = player.Character

character:WaitForChild("HumanoidRootPart").CFrame = HRPCFrame

I mean it works but I spawn back at the spawn and it just teleports me to the spawn again because thats the location of the rootpart

Unfortunately, I don’t really know of any other way to do this.

LoadCharacter doesn’t yet have spawn Position parameters, and once the player is dead, you are forced to regenerate it through some means.