How to upgrade touch event?

Hi,
I need to connect touch event to meshes, but i have 1 problem: physic hitbox is ok, but hitbox for touch is square around whole mesh, so can i make it same as physic hitox (only in on mesh surfrace)?

Hello! Are you using a SpecialMesh? Currently there is no way to connect a Touched event to its surface.

However, you can use a MeshPart instead, with the same asset ID in the MeshID property. When you set its RenderFidelity to “Precise” it should work almost perfectly for any mesh!

2 Likes

I tried it by character, and it was ok, but when i do this by projectile, it is bad (only difference, is, that when i do it by character, the event is on the part and when i do it by projectile, the event is on projectile)

Did you try the event with the projectile set to Anchored true? Maybe the problem is Touched is not functioning as well as you’d like.
In case the Touched event works fine when the projectile is anchored, you should consider using another way to connect the function.

I am using velocity, this is my code

projectile.Velocity = Vector3.new(xv.X,V0f.Y,xv.Z);
projectile.CFrame = CFrame.new(start)
projectile.Parent = workspace.Projectiles
wait(0.01)
projectile.CanCollide = true;
spawn(function () tracker.main(projectile) end)

--module
local module = {}
function module.main (projectile)
local event
event = projectile.touched:Connect(function (part) 
	event:Disconnect()
	projectile:Destroy()
	--print("1")
	if part.Parent.Parent.Parent.Name=="ships" then
		--print("2")
		part.Parent.Parent.HP.Value = math.max(part.Parent.Parent.HP.Value - 2000,0)
	end
end)
end
return module

And i also found, that it is scaled, not square around mesh.

I solved it, that when i get the event fired, i wait before touch event will be fired on the hited part, and i get much better results by this.