What do you want to achieve?
I want to disable the automatic assignment of network ownership to unanchored parts. And I don’t want to manually set the network ownership to nil for every unanchored part.
What solutions have you tried so far?
I have found this Enum, but I don’t know where to use it, and neither does the documentation.
Hey, I don’t think there’s a way to do what you want to do without looping through every part.
for index, instance in ipairs(workspace:GetDescendants()) do
if instance:IsA("BasePart") == false or instance:CanSetNetworkOwnership(instance) == false then
continue
end
instance:SetNetworkOwner(nil)
end
workspace.DescendantAdded:Connect(function(instance)
if instance:IsA("BasePart") == false or instance:CanSetNetworkOwnership(instance) == false then
return
end
instance:SetNetworkOwner(nil)
end)
This should work, but I did not test it.
The connection is needed because if you add a new unanchored part while the game is running then it will have automatic network ownership.
Just in case somebody has the same problem, here is the best “solution” so far, you will still need to set the network ownership to nil when unanchoring parts though
for index, instance in ipairs(workspace:GetDescendants()) do
if not instance:IsA("BasePart") then
continue
end
if not instance:CanSetNetworkOwnership() then
continue
end
if instance:GetNetworkOwner() then
continue
end
instance:SetNetworkOwner(nil)
end
workspace.DescendantAdded:Connect(function(instance)
task.wait()
if not instance:IsA("BasePart") then
return
end
if not instance:CanSetNetworkOwnership() then
return
end
if instance:GetNetworkOwner() then
return
end
instance:SetNetworkOwner(nil)
end)