Ball Network Ownership teleporting and bugs?

I’m trying to make a touch based soccer ball and it works by giving network ownership to player who touched it and then applying force, but when two players are constantly fighting for the ball the network ownership gets bad and it starts teleporting and keeps going in random directions on touch, any way to fix this?

script inside ball

local function onTouched(otherPart: BasePart)
	if reactDecline.Value == true then
		warn("React declined!")
		return
	end
	
	local character = otherPart.Parent
	local humanoid = character:FindFirstChild("Humanoid")
	
	if humanoid then
		local player = Players:GetPlayerFromCharacter(character)
		
		if player ~= owner.Value then
			ball:SetNetworkOwner(player)
			owner.Value = player
		end
		
		ReplicatedStorage.Remotes.Kick:FireClient(player, ball)
		kickSound:Play()
		
		reactDecline.Value = true
		task.delay(0.3, function()
			reactDecline.Value = false
		end)
	end
end

client script (to handle forces)

local function onClientEvent(ball: BasePart)
	local direction = (ball.Position - humanoidRootPart.Position).Unit
	
	local bodyVelocity = Instance.new("BodyVelocity")
	bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	bodyVelocity.Velocity = Vector3.new(direction.X, 0, direction.Z) * 30
	bodyVelocity.Parent = ball
	
	task.delay(0.3, function()
		bodyVelocity:Destroy()
	end)
end
1 Like

Why not just apply the body velocity on the server? Are you worried about replication lag? If so then just fire all clients whenever the ball is touched by the player.

Edit: if you’re concerned about too many requests then use an UnreliableRemoteEvent

2 Likes

Wdym? I’m doing the physics on client because its less strain on the server I heard

What do you mean by this sentence?