Network Ownership Resetting When Welding

Hey there, I am working on a basketball game, and our team has run into an issue with roblox’s network system.

Unfortunately, we have to set all the players’ network ownership to the server (nil) to have accurate positioning for stealing and passes. However, even after setting them to the server, it appears that they can regain their network ownership on their own. For example, when a player tries to pick up the ball, both the ball (which is set on the server as well) and the player go back to the player network.

We want everything to remain on the server, yet somehow this continues to occur. Setting the network ownership every frame (if it is not nil) causes a huge amount of lag when picking up the ball.

We are guessing this has something to do with the motor6d, since that should really be the only thing affecting anything in the real world space.

function basketball:Receive(character)
	
	-- get character class
	local characterClass = characterClasses.containers[character]

	if self.Owner or not characterClass then return end
	
	-- basketball elements
	local basketballInstance = self.Basketball
	local primaryPart = basketballInstance.PrimaryPart
	
	-- character elements
	local rightHand = character:FindFirstChild("RightHand")
	
	if not rightHand then return end

	-- assign owner
	self.Owner = character
	
	-- get character values
	local values = character:FindFirstChild("Values")

	if values then
		-- enable holding ball
		local holdingBall = values:FindFirstChild("HoldingBall")

		if holdingBall then
			holdingBall.Value = true
		end
	end
	
	-- weld basketball to character
	local motor6D = script.Motor6D:Clone()
	motor6D.Part0 = rightHand
	motor6D.Part1 = primaryPart
	motor6D.Parent = primaryPart
	motor6D.C1 = primaryPart.GripAttachment.CFrame
	
	-- change possession to character team
	possession.Value = gameManagerModule:GetTeam(character)
	
end

Anything you might know would greatly be appreciated.

1 Like

Hey there, this got buried, would anyone have some insight into this issue?

is whatever you’re welding to the player set as server ownership too?

It isn’t actually welding, the motor6D is cloned into the basketball, and the Part0 is connected to the right arm. Somehow when setting a motor6d’s part connection to something owned by a player, it gets owned by the player as well even when it is set for the server to handle it. The question really is how can I get around this or block it somehow.

hey, have you found a solution yet, i am encountering the same exact problem

I believe this is because of how roblox character system is coded, anything that is in the players character is set to be owned by them whenever its physics state update. Some solutions would be to always remove the network ownership from every part

game:GetService("RunService").PreSimulation:Connect(function()
for i,v in next, workspace:GetDescendants() do if(v:IsA("BasePart") and v:CanSetNetworkOwnership()) then v:SetNetworkOwner(nil) end end
end)

however I believe this would be pretty bad in terms of performance. You could optimize it by only looping through parts you know can be affected by network owners, such as making a folder for unanchored parts and only looping that folder.
Another solution would be to make a custom character that doesn’t use Player.Character.

a tip for debugging network ownership, you can run this in your console to see who owns what settings().Physics.AreOwnersShown = true

1 Like

No we didn’t, so we just decided to set the position of the ball on the server, and weld a clone locally for visuals.

I believe you are correct, there just isn’t a good way to fix that other than going around the issue.

so you replicated the welding on client and the shooting on server ?

Yeah, the ball is just hovers around the player’s hand on the server