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

How do I code a KillBrick system?

Well, hello! I’m trying to make a killbrick script but something is certainly wrong with it what did I do wrong?

local KillBrick = script.Parent

Part.Touched:Connect(function(hit)
       if hit.Parent:FindFirstChild(“Humanoid”) then
           hit.Parent.Humanoid.Health.0
end)


1 answer

✓ Accepted answer

First of all, you use Part.Touched instead of KillBrick.Touched. Secondly, it needs to be hit.Parent.Humanoid.Health = 0. Also your quotations look weird and they are not a string. Also you didn't put an end for your if statement.

local killBrick = script.Parent

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

2 comments

0

Thank you so much for helping me, I need a end for if statement too?

0

Yes.

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