Hello, in the game I’m trying to change players character when certain level is reached. I’ve achieved this with this script:
local oldPosition = player.Character.PrimaryPart.Position
local charClone = game:GetService("ServerStorage"):WaitForChild("NewChar"):Clone()
charClone.Name = player.Name
player.Character = charClone
charClone.Parent = workspace
charClone:MoveTo(oldPosition)
Everything seems to be working fine, except that When it’s moved, the cloned character doesn’t face the same direction like the old character. Any suggestions how could I achieve this? Thanks!
I think the solution is very simple but it may not work, but here is the idea, in the end of the level or whatever player overcome, u can grab the orientation of the player parts and then, before placing clone into workspace, rotate body parts of clone via looping with for _,v in pairs(Clone:GetChildren()) do , so it will be rotated by angles that player has.
Hey. You could just grab old character’s CFrame instead of position, as mentioned by , @rotbotrotbot , as CFrame corresponds to both position and orientation, not just the position. So generally, if you set new character’s CFrame to the old character’s CFrame, it’s going to be facing the same direction.
Also, you don’t have to, but I think it would be a better idea to first set the clone’s CFrame, then parent it to workspace, and finally set it to be the player’s character.
Code example:
local OldCFrame = player.Character:GetPrimaryPartCFrame()
local CharClone = game:GetService(“ServerStorage”):WaitForChild(“NewChar”):Clone()