How would I go about changing the position of a cloned character?

I’ve made a clone of the localplayer into the workspace. It spawns directly in front of the current player, which I don’t want. I would like to set a specific position for the player’s clone to spawn at. How would I go about doing so?

2 Likes

You can do it using the :PivotTo() method of player’s character

local player
local character = player.Character or player.CharacterAdded:Wait()

character:PivotTo(CFrame.new(Vector3.new(0, 10, 0)))

This code will make the player’s character go to world space position 0, 10, 0

It didn’t quite work.

Here’s the script I have:

wait(2)
local Player = script.Parent
Player.Archivable = true
local PlayerClone = Player:Clone()
PlayerClone.Archivable = false
PlayerClone.Parent = game.Workspace


local character = Player.Character or Player.CharacterAdded:Wait()

character:PivotTo(CFrame.new(Vector3.new(-3.602, 0.5, -28.262)))

It does clone the character into workspace correctly, but it still is spawning directly in front of the player.

It’s in a local script in StarterCharacterScripts

I fixed it. Very simple fix, actually.

My script:

wait()
local Player = script.Parent
Player.Archivable = true
local PlayerClone = Player:Clone()
PlayerClone.Archivable = false
PlayerClone.Parent = game.Workspace
PlayerClone:PivotTo(CFrame.new(26.838, 0.5, -0.025))

Thanks to those who offered support.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.