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

Whats wrong with my kill script? I can only find ontouch function scripts

Hi, I made this script and it doesnt work whats up with it? I ve been searching for kill scripts for so long now and I only find ontouch scripts

while 0<1 do
	wait(5)
	local humanoid = game.Parent:FindFirstChild("Humanoid")
	humanoid.Health = 0
end

its probably the 'game.' but i dont know what to put there instead i tried script. but nothing

Thanks again for your time!

2 answers

✓ Accepted answer

Alright, I can see that you dont want a kill brick script. You want to kill a player without him touching a brick or smth.

Like the other guy said, you didnt provide enough information in the script to know which player to kill.

the correct thing would be like this in a normal script in serverscriptservice:

TargetPlayer = --The Players name you want to kill.

while true do
wait(5) -- every 5 seconds the player will die
game.workspace.TargetPlayer.Humanoid.Health = 0
end

2 comments

1

Awesome perfect thanks so much!..Yeah im new in programming i have no idea what im doing learning as i go.

0

But how do i target all players?

That will just loopkill a player. You didn't provide enough information for anyone to help you.

Multiple other things too. game.Parent is not accessible. Game is a roblox default varriable and cannot be overwritten.

If you want a part to kill a player:

game.Workspace.Part.Touched:Connect(function(part)
	if part.Parent:FindFirstChild("Humanoid") then
		part.Parent.Humanoid.Health = 0
	end
end)

2 comments

0

No i dont want a part to kill a player as i stated in the question discription ("i can only find ontouch kill scripts") i want the player to be killed on loop

0

I should have also just stated that i need a simple kill script but im too dumb haha . Thanks for helping

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