So basically I have this kill brick that kills people at different intervals. The problem with this, is if the player stands still, they technically don’t touch it. Meaning the touch event fires, it doesn’t detect them. All help appreciated!
script.Parent.Touched:Connect(function(hit)
if script.Parent.Electro.Enabled == true then
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end
end
end)
A better idea is to run a touched event on a players leg/foot and check whether it is the type of part you want to kill the player with CollectionService.
Are you making an obby where the player jumps onto the part? I don’t understand exactly what you’re trying to do… what do you mean by different intervals?
local killPart = script.Parent
local killInterval = 2
while true do
wait (killInterval)
local parts = killPart:GetTouchingParts()
for i = 1, #parts do
local part = parts[i]
if part.Parent:FindFirstChild("Humanoid") then
part.Parent.Humanoid.Health = 0
end
end
end
This would only work if the gate was collideable. :GetTouchingParts() returns an empty table when CanCollide is set to false. I don’t think .Touched has this same issue.