Having a problem with "Teleporting a player from a position to another."

I’m trying to teleport player to a certain place but it just changes position of the bodypart which is given in there. (I tried HumanoidRootPart but it didn’t worked)

function onButtonTouched(player)
	--[[Appearance]]--
	Button.BrickColor = BrickColor.new("Really red")
	local charClone = Character:Clone()
	charClone.Name = player.Name
	player.Character = charClone

	local rootPart = charClone:FindFirstChild("HumanoidRootPart") or charClone:FindFirstChild("Torso")
	local plrRoot = player.Character:FindFirstChild("HumanoidRootPart") or player.Character:FindFirstChild("Torso")

	if rootPart and plrRoot then
		rootPart.CFrame = plrRoot.CFrame
	end

	charClone.Parent = workspace

	local number = math.random(0, #Spawns)
	local chosenSpawn = Spawns[number]
	rootPart.Position = chosenSpawn.Position
	task.wait(2)
	Button.BrickColor = BrickColor.new("Sea green")
end

There is no errors.

1 Like

If I’m understanding this right, you’re trying to move a player to the chosen spawn.

Don’t change the position, change the CFrame.
rootPart.CFrame = chosenSpawn.CFrame

1 Like

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