i tried this script:
script.Parent.Touched:connect(function(_o) pcall(function() _o.Parent:BreakJoints() end) end)
but sometimes if the character constantly jumps on the brick this script it inserted into, the BreakJoints doesn't work(sometimes the lava glitches)
how do i make it so that the BreakJoints() happens immediately, or almost immediately
e.e
This is a very odd way to make a kill brick. It is normally done as following:
function kill(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = 0 end end script.Parent.Touched:connect(kill) --Or, with an anonymous function, script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = 0 end end)
However, there is no way to prevent occasional glitching. If the touched event does not fire, it is Roblox's problem and there's nothing you can do about it. Sometimes it helps to make the brick CanCollide false, but even still it sometimes does not fire the touched event.
Here is how I would do it..
script.Parent.Touched:connect(function(Hit) if game.Players:GetPlayerFromCharacter(Hit.Parent) then Hit.Parent:BreakJoints() -- For Players elseif Hit.Parent:FindFirstChild('Humanoid') then Hit.Parent.Humanoid.Health = 0 -- For NPCs end end)