Hello, y’all. I have problem with ‘SetNetworkOwner’ function. It gives me an error ‘Network Ownership API cannot be called on Anchored parts or parts welded to Anchored parts.’ There is no anchored parts or else.
Code:
script.Parent.ChildAdded:Connect(function(child) --It's a folder.
local Player = Players:GetPlayerByUserId(tonumber(script.Parent.Name)) --Folder name is player id
if not Player then return end
local Character = Player.Character
if not Character then return end
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
if not HumanoidRootPart then return end
local petPrimary = child.PrimaryPart --Pet's main part/primary part
petPrimary:SetNetworkOwner(Player) --Problem
end)
Can’t hurt to make sure:
Ensure that child is actually unanchored. You can check that with a script like this:
if child:IsA("BasePart") then
child.Anchored = false
else
for _, desc in ipairs(child:GetDescendants()) do
if desc:IsA("BasePart") then
desc.Anchored = false
end
end
end
Not sure if misunderstood, but you could do “not :CanSetNetworkOwnership()” if you’re looking for a basepart who just won’t SetNetworkOwnership()
Btw I’ve never had issues setting network ownership to parts with welds and who is welded to anchored parts.
for _,BasePart in pairs(yourPet:GetDescendants()) do
if BasePart:IsA("BasePart") and not BasePart:CanSetNetworkOwnership() then
print(BasePart.Name)
end
end