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

The kill script is not working and have written it correctly?

script.Parent.Touched:Connect(function(Hit)
	if Hit and Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") then
		Hit.Parent.Health = 0
		
	end
	
	
	
	
	end)


1 comment

0

Because Hit.Parent would be the Character model of the player which is just a regular model and Health is not a property of the model so do Hit.Parent.Humanoid.Health = 0 that will work. All characters have a humanoid in it which has a lot of properties here are the properties of the humanoid https://developer.roblox.com/en-us/api-reference/class/Humanoid. The developer wiki can teach you a lot.

1 answer

try this:

script.Parent.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
Hit.Parent.Humanoid.Health = 0
end
end)

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