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

Touch function bugging? Kills me when my head is no where near the killbrick

Asked by 3 years ago

The code detects the player first if its touched it. And then it detects if the name of the hit is the head yet sometimes it kills me when the head isnt touching the killbrick .. Heres the script(its in a function)

~~~~~~~~~~~~~~~~~ function module.waterchecktouch(map) local water = map:GetChildren()

for i = 1, #water do
    if water[i]:FindFirstChild("_iswater") then
        water[i].Touched:connect(function(hit)
            if hit.Parent:FindFirstChild("Humanoid") then
                if hit.Name == "Head" then
                    hit.Parent.Humanoid.Health = 0
                end
            end
        end)
    end
end

end~~~~~~~~~~~~~~~~~

0
Well, I tried it in Studio and it worked perfectly fine! If it's killing on getting hit when its not the head, the head might have touched it for a milisecond or it won't kill. BestCreativeBoy 1395 — 3y
0
Oh ! Alright thanks! robert19735 17 — 3y
0
You could use a local script in a part and insert this code ksvrkp01 -7 — 3y
0
@ksvrkp01 Local script does not work in workspace. BestCreativeBoy 1395 — 3y

Answer this question