How do I make a brick that damages players? Answer below if you know.
-Carlardar
You need to run a Touched
event on a part, then make sure the toucher is a human, and then damage it:
script.Parent.Touched:connect(function(hit) -- When part is touched if hit.Parent:findFirstChild("Humanoid") then -- Check if it is a player hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 50 -- Change '50' to how much you want it to damage end end)
script.Parent.Touched:connect(function(hit) human = hit.Parent:FindFirstChild("Humanoid") if human then human:TakeDamage(10) -- change the number in parenthesis to whatever you like end end)
script.Parent.Touched:connect(function(p) local x = 50 -- CHANGE THIS TO THE AMOUNT OF DAMAGE local h = p.Parent:findFirstChild("Humanoid") if (h ~= nil) then h:TakeDamage(x) end end)