Hello. I need to set the player’s network ownership to the server. But when I do this, I get an error that says that I cannot set the network ownership of parts that are anchored, or welded to anchored parts. But the player’s character isn’t anchored, and as far as I’m aware… it shouldn’t be welded to anything that is anchored? I could use something like a repeat task.wait() until notAnchored
loop, but I’m pretty sure it is bad practice to use loops like this.
local players = game:GetService("Players")
local function setNetworkOwner(part)
if part:IsA("BasePart") then
part:SetNetworkOwner(nil) -- Set the network owner to the server
end
end
local function manageCharacter(character)
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
local hrpParent = hrp:IsDescendantOf(workspace)
if hrpParent == false then
repeat
hrp.AncestryChanged:Wait()
until hrp:IsDescendantOf(workspace)
end
end
character.DescendantAdded:Connect(function(descendant) -- New parts added to the character
setNetworkOwner(descendant)
end)
for _, descendant in pairs(character:GetDescendants()) do -- Existing character parts
setNetworkOwner(descendant)
end
end
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
manageCharacter(character) -- https://devforum.roblox.com/t/how-to-move-character-movement-to-the-server/2302307/2
player.DevComputerMovementMode = Enum.DevComputerMovementMode.Scriptable
player.DevTouchMovementMode = Enum.DevTouchMovementMode.Scriptable
end)
end)