Can anyone help why i cant move

when i join, i get morphed when im on a team (employees) but i cant move in the morph. the characters are from rig builder.

local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

local teamMorphs = {
    ["Employees"] = ServerStorage:WaitForChild("Emp"),
    ["Security"] = ServerStorage:WaitForChild("Secu")
}

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        task.wait(0.1)

        local teamName = player.Team and player.Team.Name
        local morphModel = teamMorphs[teamName]

        if morphModel then
            local morph = morphModel:Clone()
            local root = character:FindFirstChild("HumanoidRootPart")
            local morphRoot = morph:FindFirstChild("HumanoidRootPart")

            if root and morphRoot then
                morphRoot.CFrame = root.CFrame
            end

            morph.Parent = workspace
            player.Character = morph
            player.Character:WaitForChild("Humanoid"):LoadAnimation(nil)
            game.Workspace.CurrentCamera.CameraSubject = morph:WaitForChild("Humanoid")
        end
    end)
end)

the characters are unanchored and this is a script from serverscriptservice.

3 Likes

you only change character on server, and on client you change camerasubject.
don’t forget to remove old character networkowner and give new char

2 Likes

you should use PivotTo(CFRAME) I find that its better for moving a models position,
:LoadAnimation(nil) doesn’t work to wipe anims If im correct,
I think you would have to loop through the anims playing on the animator

if you can get CurrentCamera then your on the client, which means your morphing from the client, which is the cause of your error most likely