.Touched not firing

I don’t understand why the .touched event doesn’t fire.
(The gray part in the mob’s torso is supposed to fire a touched event if it touches the unanchored big grey part)

mob.Part.Touched:Connect(function(part)
	print(part)
end)
1 Like

Do both of the parts have the CanTouch property set to true?

Yes, both of the parts have canTouch set to true.

Try this.

print("Connecting touched event")
mob.Part.Touched:Connect(function(part)
	print(part)
end)

If that doesn’t print, there’s a structural problem with your code.

It prints. Though I don’t think it’s a problem with the code.

This is quite odd. Maybe observe the part’s properties while the game is running? That might give you a clue on what’s going wrong here. (I’m suggesting this because humanoids have a tendency to completely mess up the properties of a characters BaseParts)

Yes, it is, but what’s even stranger is that it prints out when my character touches the mob’s grey part. But not the big grey part. I even tried making it cancollide, but it wont print.

Well that means that it might be a problem with the actual part and not the zombie’s parts

I don’t know what tho. It’s an ordinary part.

for i,v in pairs(newmap:WaitForChild("waypoints"):GetChildren()) do
		local ah = Instance.new("Part")
		ah.Size = Vector3.new(2,2,2)
		ah.Parent = v
		local weld = Instance.new("Weld")
		weld.Parent = v
		weld.Part0 = v
		ah.CFrame = v.CFrame
		weld.Part1 = ah
		ah.CanCollide = false
end

Also in your original post, are you viewing the workspace from the client or the server?

I am viewing it from the client

View from the server. This might be caused by a replication issue.

It looks like it’s the same… Client and server

Try comparing the properties, otherwise I have no idea what might be causing this.

Yeah properties are the same, but i think one of the objects has to be in motion. The mob is constantly getting it’s cframe changed

Touched event might be linked to physics, all I can think of is to do tests at this point.

1 Like

Touched event only works with physics, you need to use a shape cast.

Well, i wouldn’t really want raycasting every .1 seconds, i’d like it to do something once the grey part’s been touched…

That is actually not needed. You can use :GetPartsInBoundingBox() on the zombie but again, that is probably as bad as raycasting every frame.

Yeah that’s the problem i’m facing. I don’t want to waste resources on something that isn’t so important in my game… “.Touched” would’ve been perfect…