To create somebody's character, call Players:CreateHumanoidModelFromUserId
with the Player's UserId
. Then you can move it by calling PivotTo
on their HumanoidRootPart
.
Note: do not use Model.PrimaryPart
to grab the HumanoidRootPart. On R6 characters, this is actually the character's Head. You're better off calling FindFirstChild("HumanoidRootPart")
(or WaitForChild
).
You'll notice that this positions the character from their torso's center, and not from their feet. So you'll need to offset that vertically by 3 studs if the character is not Rthro (is of fixed size, like R6). If the character is Rthro (is R15, and your game has scaling enabled), then you'll need to call GetExtentsSize
on the character Model.
So, something like:
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local function loadStage(player: Player)
-- ...
local character = Players:CreateHumanoidModelFromUserId(player.UserId)
local rootPart = character:FindFirstChild("HumanoidRootPart")
-- assuming R6 this will be fine
rootPart:PivotTo(CFrame.new(myDesiredPosition + Vector3.yAxis * 3))
rootPart.Parent = Workspace
-- ...
end
Players.PlayerAdded:Connect(function(player)
loadStage(player)
end)