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

Issues with lava blocks and can collide , Can someone help ?

Hello everyone, I am a beginner scripter and i have some issues with a lava block script, here is the reason: block keeps killing me if its invisible, here is the script:

function onTouched(hit)

local h = hit.Parent:findFirstChild("Humanoid")

if h ~= nil then

h.Health = 0

end end script.Parent.Touched:connect(onTouched)

Do someone have any suggestion to fix this ??

3 comments

0

Try this: function onTouched(hit) if script.Parent.CanCollide ~= false then local h = hit.Parent:findFirstChild("Humanoid") if h ~= nil then h.Health = 0 end end end script.Parent.Touched:connect(onTouched)

0

I want to try but how i could line that

0

Remove the health with h.Health = h.Health - 100

1 answer

Try this:

function onTouched(hit) 
if script.Parent.CanCollide ~= false then -- here
local h = hit.Parent:findFirstChild("Humanoid")
 if h ~= nil then h.Health = 0 
end end end 
script.Parent.Touched:connect(onTouched)

The script is looking if the block can colide where i put this "-- here" if it does not collide it wont go any further. Let me know if it works.

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