hi all i can script is doors that change color coz i started 2 days ago and i need help with a lava block script
local Lava = script.Parent
function dieontouch(Brick)
local somerandomperson =
Brick.Parent:findFirstChild("Humanoid")
if (somerandomperson = ~= nil) then
somerandomperson.Health - 100
end
end
Lava.Touched:Connect(dieontouch)
Hello, so what you need to do is this:
local Lava = script.Parent
function dieontouch(Brick)
local somerandomperson=Brick.Parent
if (somerandomperson = ~= nil) then
somerandomperson:BreakJoints()
end
end
Lava.Touched:Connect(dieontouch)
Thats it.
Put this inside of a Part
script.Parent.Touched:Connect(function(WhatTouched) if WhatTouched.Parent:FindFirstChild("Humanoid") then local hum = WhatTouched.Parent:FindFirstChild("Humanoid") hum:TakeDamage(.5) --.5 amount of damage else return end end)
WhatTouched
Is the part that makes contact
WhatTouched.Parent:FindFirstChild("Humanoid")
Checks to see if there is a
Humanoid
inside of the Parent of the Part that touched and
:TakeDamage()
Only compatible with Humanoids, Takes Damage, by a given integer within the parenthesis