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

Why .Touched event won't hit anything except character?

Asked by 3 years ago
Edited 3 years ago

I'm trying to make a gun script using .Touched instead of raycast, so I'll have a moving bullet.

but for some reason when I try to use .Touched, it won't hit anything except character itself

local bullet = script.Parent
local Filter = script.Parent:WaitForChild('Filter')

repeat wait() until Filter.Value ~= nil

bullet.Touched:Connect(function(hit)
    --if hit.Parent.Name == Filter.Name then
    --  hit = nil
    --  print(hit)
    --else
        print(hit)
        bullet:Destroy()
    --end
end)

I tried shooting at ground, at dummy but it didn't hit them, it hits only character torso, HRP, Handle and etc

FIX: I've been asked to explain how I fixed it, basically .Touched event works only if one part is unanchored. If part0 is anchored and touches part1 which is also anchored, it won't work. .Touched event is only for physical interactions. So instead of using .Touched, I used Region3

0
fixed digameschannel 44 — 3y
0
Could you post your fix to this issue? Other people might be experiencing the same issue you have and would like to have an explanation loowa_yawn 383 — 3y
0
k digameschannel 44 — 3y

Answer this question