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

3 comments

0

fixed

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

0

k