Die when you spawn


  1. What do you want to achieve? I need a script that kills you instantly when you spawn, because apparently, this system I have, doesnt work unless you die once

  2. What is the issue? I cannot make the script nor find it because no one else has this problem

  3. What solutions have you tried so far? looked in the toolbox and youtube, and on the forum. Nada!

If anyone can help, it would be great

1 Like
local plrs = game:GetService("Players")

local h = c:WaitForChild("Humanoid",5)
if h then
h.Health = 0

Sorry for the bad code formatting and variable names, I didn’t have much time.

This code won’t work, because you’re connecting a coroutine and will only run once. Also, don’t use -math.huge as the health or math.huge as you WaitForChild timeout.

Connecting a function automatically creates a new thread.

Isnt that what were looking for? something that will kill the player once?

If the player respawns multiple times and you use their code, they will not automatically die the second time that they respawn.

Thats exactly what I want, thanks for explaining that well

This doesn’t exactly kill me, it leaves me with some health

then repeat it

local Players = game:GetService('Players')

local function KillPlayer(Character)
	repeat task.wait(0.5)
		if Character:FindFirstChildOfClass("Humanoid") then
			Character:FindFirstChildOfClass("Humanoid").Health = 0
	until not Character.Parent

	task.spawn(KillPlayer, Player.Character or Player.CharacterAdded:Wait())

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.