Ad
Log in to vote
0

Why doesn't the Touched event fire on a player when they are sitting?

Asked by 1 year ago

I have a game where lava rises, if it touches you you die. The only issue is that when you're sitting down the touched event doesn't work and the lava rises right over top of you. Has anyone else ever come across this issue?

1 answer

Log in to vote
1
Answered by 1 year ago
Edited 1 year ago

Hello, you can use magnitude instead, like this:

Script:


local players = game:GetService("Players") while wait() do for i, v in pairs(players:GetChildren()) do local char = v:WaitForChild("Character") local foot = char.FOOT -- Idk how it is called right now, you can use leg instance or foot instance on R15 local lava = lavaLocation -- past here your lava part location if (lava.Position - foot.Position).magnitude < 1 then -- if lava is less then 1 foot away from middle of leg or foot part char.Humanoid.Health = 0 -- kill player end end end
Ad

Answer this question