Killbrick Doesn't work

Hi Developer

So I have a problem, I’m on making Killbrick but I think this script is correct, and there are no problems in the Analysis Script

here the photo

1 Like

change humanoid.Health = 0 to humanoid:TakeDamage(humanoid.MaxHealth) see if it works

2 Likes

buddy try using the collection service event, maybe the parts just didnt get added when u checked for all tags

it Doesn’t work to. I’ve followed your suggestion

I don’t really know what you mean, but I follow this guy https://youtu.be/80z3Xg8Sy_g?si=nT1RXT3JCQHIOQfu

can you print part in line 15

1 Like

change part.Touched:Connect(onPartTouched) to

part.Touched:Connect(function(hit)
	onPartTouched(hit)
end)
1 Like

There is no use is using a function to loop through items that will be used only once. Remove it. Also it could also be because you maybe did not tag them.

2 Likes

Another thing you could do is instead of using tags and CollectionService, is put all the kill bricks into a folder and insert a script. Name it KillBrickHandler.
The hierarchy should look like this:
image
Insert this code into your script:

local folder = script.Parent

for _, part in pairs(folder:GetChildren()) do
	if part:IsA("Part") then
		part.Touched:Connect(function(otherPart)
			local Character = otherPart.Parent
			local Humanoid = Character:FindFirstChild("Humanoid")
			
			if Humanoid then
				Humanoid:TakeDamage(Humanoid.MaxHealth)
			end
		end)
	end
end

Let me know if there are any bugs or something doesn’t work. Hope this helps! :slight_smile:

2 Likes

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