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

How do u script a brick (to kill peaple)??

4 answers

Make a brick called KilledBrick then make a script and put it in the ServerScriptService

Put this in the script

for I, part in pairs(game.Workspace:GetChildren()) do
   if part.Name == "KillBrick" then
         part.Touched:connect(function(object)
          if object.Parent:IsA("Model") then
            local Hum = object.Parent:FindFirstChild("Humanoid")
            if Hum ~= nil then
             Hum.Health = 0
            end
          end
         end
   end
end

I made one the other day with this script:

script.Parent.Touched:connect(function(touched)
	local found = touched.Parent:FindFirstChild("Humanoid")
		if found then
			touched.Parent.Humanoid.Health = 0
				end
					end)

Hope this helps.

If you just want one part to kill people, put this script in it.

local part = script.Parent
part.Touched:connect(function(hit)
	local hum = hit.Parent:FindFirstChild("Humanoid")
	if hit.Parent:IsA("Model") and hum then
		-- this means that a player or an NPC touched the part
		hit.Parent:BreakJoints()
	end
end)

1 local part = script.Parent 2 part.Touched:connect(function(hit) 3 local hum = hit.Parent:FindFirstChild("Humanoid") 4 if hit.Parent:IsA("Model") and hum then 5 -- this means that a player or an NPC touched the part 6 hit.Parent:BreakJoints() 7 end 8 end)

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