Alternative for Touch Event delay?

Making a little beam attack and as you can see on the right works perfectly fine and moves smoothly but on the left for the victim its delayed. Im using networkownership and setting to player seems to only make it look nice and smooth for the user. Setting to nil just keeps a delay velocity look for both of us as well as touch delay. So whats the best alternative method to avoid this issue???



    local Char = Player.Character
	local HumRT = Char:FindFirstChild("HumanoidRootPart")
	
	local beenhit = {}
	

		local ball = repstore:FindFirstChild("Ball"):Clone()
		ball.Parent = workspace
		ball.CFrame = HumRT.CFrame
		--* CFrame.new(math.random(-3,3),math.random(-3,3),0)

		ball:SetNetworkOwner(Player)


		local vel = Instance.new("BodyVelocity",ball)
		vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		vel.Velocity = HumRT.CFrame.LookVector * 200

		game.Debris:AddItem(ball,5)
		
		
		ball.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 not hit:IsDescendantOf(ball) and hit.Parent:FindFirstChild("Humanoid") then
					beenhit[hit.Parent] = true
					spawn(function()
						wait(1)
						beenhit[hit.Parent] = false
					end)
				
					ball:Destroy()
				
					hit.Parent.Humanoid:TakeDamage(10)
					
					game.ReplicatedStorage.Barrage:FireAllClients(hit)
					
				end
			end
		end)

you could try using raycasts, they work pretty well

1 Like

this makes it delayed for other people as you create the visual first on the client and THEN replicate to others, you also make the hitbox on the client and not on the server from what i see and that may be the biggest problem

Maybe not this. Player simulates physics of ball, delay to server recognizing interaction?, delay to other player. Just worse for others.

Besides, couldn’t someone just teleport the ball at target :confused:

Maybe you can have the server make the ball and decide collision but have clients kill ball and produce effects.

I made my own solution by creating an invisible ball with no effects and acting as the hitbox on server while also creating the ball on client with effects running at same time and it honestly works perfectly.