Touched Event Not Firing at right Time for projectile

https://streamable.com/gmpgan

So I’m making a snowball projectile and as you can see in the video there seem’s to be lag with the touched event. It hits the target and does the explosion but as you can see the ball disapears a bit early then expected as on contact the script is told to delete the part and do the explosion effect with client effects. I set networkownership to nil on server before doing velocity. Setting it to player before only made it look natural for me but for other players still delayed. So what do I need to do for the touched event to go off at the right time for everyone???

-- Server Throw script--
elseif Type == "Throw" then
		if Rolling.Value == false then
			local Animation = Instance.new("Animation")
			Animation.AnimationId = BlessingModule["ThrowAnimationID"]
			local Throw = Hum:LoadAnimation(Animation)
			Throw:Play()
			Throw:AdjustSpeed(1.6)

			local Snowball = Debris.SearchPlrFolderFor("Snowball",Character.Name)
			Snowball.Name = "ThrownSnowball"

			spawn(function()
				wait(.05)
				for i,v in pairs(Snowball:GetChildren()) do
					if v:IsA("ParticleEmitter") then
						v.Enabled = true
					end
				end
			end)
			
			Debris.rsWait(.28)
			Snowball:FindFirstChild("SnowballWeld"):Destroy()
			
			Snowball.CFrame = RightHand.CFrame
			
			Snowball:SetNetworkOwner(nil)

			Velocity.AngleAndMouseVelocity(Mouse,Snowball,Snowball,BlessingModule["Speed"],1e8,1e8,1e8,0,0,0,5) -- Velocity Module
		
			Destruction.Touched(Snowball.hitbox,Character,BlessingModule["Damage"],BlessingModule["NoDmgTime"],BlessingModule["ExplosionType"]) -- TOuched event module

			
			Debris.rsWait(1)
			
			if Blessing.Value == "Default" then
				Default_Reload(BlessingFolder,Debris,Instances,Character,RightHand)
			end
			
		

		end
	end
--Velocity Module Part--
function Velocity.AngleAndMouseVelocity(Mouse,StartPos,Part,Speed,ForceX,ForceY,ForceZ,DirectionX,DirectionY,DirectionZ,Time)
	spawn(function()

		local Vel = Instance.new("BodyVelocity",Part)
		Vel.MaxForce = Vector3.new(ForceX,ForceY,ForceZ)
		Vel.Velocity  = CFrame.new(StartPos.Position,Mouse.p).LookVector * Speed --+ Vector3.new(DirectionX,DirectionY,DirectionZ)
		Debris.rsWait(Time)
		Vel:Destroy()
	end)
end
--The touched event if ya need to see--
local beenhit = {}

function destruction.Touched(Part,Char,Damage,NoDmgTime,Type)
	Part.Touched:Connect(function(hit)
		if hit:IsA("BasePart") or hit:IsA("MeshPart") then
			if not beenhit[hit.Parent] and hit.Parent.Name ~= Char.Name and not hit:IsDescendantOf(Char) and hit.Name ~= "Shock" and hit.Name ~= "dashpart" and hit.Name ~= "snowdust" and hit.Name ~= "Baseplate1" then
				beenhit[hit.Parent] = true
				Debris.addItem(Part.Parent,0)
				spawn(function()
					Debris.rsWait(NoDmgTime)
					beenhit[hit.Parent] = false
				end)
				print(hit.Name)
				if hit.Parent:FindFirstChild("Humanoid") then
					--DamageRemote:FireServer(hit.parent,Damage,Type,hit)
					DamageModule.Person(hit.parent,Damage,Type,hit)
					print("HIT HUMANOID")
				end

				

			end
		end
		
	end)
end

Server Testing in Roblox Studio Test Tab (roblox.com)

1 Like

Try lerping the CFrame to move the object forward and every lerp check if the ball is withing a certain distance of an object with raycasting

1 Like

Thank you for the help now I can make sure my games work!

https://streamable.com/vlm8ud
I mean setting it to player prior to velocity part works like i mentioned early but the snowball will lag for the opponent like it will look fine to me but for them its like it just teleported and they got hit when they weren’t near it just like in the first video on the left i posted earlier

instead of using .touched you should use rotatedregion3 for stuff like hitboxes: