Client Side Teleport

Currently, I am trying to make a customization room
Local Character teleportation for client-side character customization (I know this devforum post exists but I don’t really understand it)

Essentially, what I have right now is a teleport script

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local RootPart = Character:WaitForChild("HumanoidRootPart")
local TargetPosition = Vector3.new(-16.225, 0.555, 34.677) --Replace this with the position you want the player to move to.
RootPart.CFrame = CFrame.new(TargetPosition)

However, this operates the character on the server side as well so it is no good, I’d appreciate if anybody was able to help.

The post suggested to clone the character and teleport the clone instead. Why not do that? (Make sure to set the character’s Archivable to true first, so you can clone it)

Or why do you want client-sided teleportation?

I didn’t understand it, or at least how I could implement it.

(I wanted client-sided teleportation cause this is to be a customization room - it wouldn’t work if there were loads of players crammed in there)

It’s just simple cloning.

character.Archivable = true -- By default roblox sets this to false. Without this you cant clone.
local clone = character:Clone()
clone.Parent = workspace
clone:SetPrimaryPartCFrame(CFrame.new(TargetPosition))

I meant more the events, such as if you clicked on something that equipped onto your character how you would replicate that to the clone and the character.

I.e. A helmet

You would use remotes. When you click a button, you fire a remote with the name of the thing you want to equip. You then clone the helmet to the fake character and the real one.

button.Activated:Connect(function()
    local item = folder[item.Name]
    item:Clone().Parent = clone
    remote:FireServer(button.Name)
end)

folder would likely be some folder in replicated storage with all your items. The button name would be the same as the thing you want to equip.

Alright, I’ll give this a go and see if it works - thanks for your help so far.

Do you know how I would implement the character wait into my script so that as soon as the character is loaded they are cloned and the clone is teleported.

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local RootPart = Character:WaitForChild("HumanoidRootPart")
local clone = Character:Clone()
local TargetPosition = Vector3.new(-16.225, 5.085, 34.677) --Replace this with the position you want the player to move to.
Character.Archivable = true -- By default roblox sets this to false. Without this you cant clone.
clone.Parent = workspace
clone:SetPrimaryPartCFrame(CFrame.new(TargetPosition))

You need to set the Archivable before cloning.

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait() -- :wait is deprecated use :Wait
Character.Archivable = true
local RootPart = Character:WaitForChild("HumanoidRootPart")
local clone = Character:Clone()
local TargetPosition = Vector3.new(-16.225, 5.085, 34.677) --Replace this with the position you want the player to move to.
clone.Parent = workspace
clone:SetPrimaryPartCFrame(CFrame.new(TargetPosition))

Yes, it is set if you check my post.

What I mean is, is there a way I can wait for the player to fully load before they are cloned and teleported?

Use the CharacterAppearanceLoaded event instead of CharacterAdded. And your code set it to true after cloning, and thus wouldn’t work.

Sorry - I thought you meant I hadn’t added it to my code.

Also, I still am confused about how I would go around implementing that into my code, Player | Documentation - Roblox Creator Hub

This seems like a lot of code which I don’t really understand how I would apply this to my situation, could you explain?

You don’t need to use that code?

Just change the event?

local Character = Player.Character or Player.CharacterAppearanceLoaded:Wait()

There is a slight issue - most of my character was loaded when cloned but uh, image
As you can see my hair was exempt, image

Is this just the case sometimes or is there a way I can 100% make it work?

Also, I’m trying to implement that LocalScript code you gave earlier on.

button.Activated:Connect(function()
    local item = folder[item.Name]
    item:Clone().Parent = clone
    remote:FireServer(button.Name)
end)

However, I’ve slightly edited it.

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAppearanceLoaded:Wait()
local clone = Character:Clone()
function OnClick()
local item = game.ReplicatedStorage.meshes.Webbing.Webbing
item:Clone().Parent = clone
end
script.Parent.MouseButton1Click:connect(OnClick)

But, this isn’t working. I’m guessing it has something to do with the clone bit - trying to identify what the clone is - any help?

I have also found that if you reset your character is cloned again, this shouldn’t happen. Do you know how I can fix this?