Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

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 ??

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) esepek 103 — 4y
0
I want to try but how i could line that LaaserPrimeYT 1 — 4y
0
Remove the health with h.Health = h.Health - 100 KingDomas 153 — 4y

1 answer

Log in to vote
0
Answered by
esepek 103
4 years ago
Edited 4 years ago

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.

Ad

Answer this question