Teleportation Issue; player teleports somewhere, while the server sees it different

Hey there,

I was working on my, where I need to move all the players in the game after they unlock a certain door.
The problem then comes after the players teleport, here are pictures:
The client, this is what everyone should be seeing basically.


The server, this is what the server is seeing.

All the players are moved using a Script and not a LocalScript
Here’s the script:

script.Parent.Triggered:Connect(function(player)
	if player then
		if player.Character or player.CharacterAdded:Wait() then
			local Backpack = player.Backpack
			local Character = player.Character or player.CharacterAdded:Wait()

			if Backpack:FindFirstChild("Crowbar") or Character:FindFirstChild("Crowbar") then
				script.Parent.Enabled = false
				script.Parent.Parent.Anchored = false
				script.Crowbar:Play()
				game.ReplicatedStorage.Tp:FireAllClients(10, true)
				wait(1)
				local City = game.ReplicatedStorage:WaitForChild("Maps"):WaitForChild("City"):Clone()
				local OutsideHouse = game.ReplicatedStorage:WaitForChild("Maps"):WaitForChild("OutsideHouse"):Clone()
				City.Parent = workspace
				OutsideHouse.Parent = workspace
				for i, v in pairs(game.Players:GetChildren()) do
					if v and v:IsA("Player") then
						local Character = v.Character or v.CharacterAdded:Wait()
						game.ReplicatedStorage.Error:FireClient(player, "Door unlocked. Leaving house", 4)
						wait(1)
						Character:WaitForChild("HumanoidRootPart").Position = workspace:WaitForChild("TpToCity").Position -- THIS IS THE IMPORTANT PART WHERE THEY TELEPORT!
					end
				end
				workspace:WaitForChild("RevampedHouse"):Destroy()
			else
				game.ReplicatedStorage.Error:FireClient(player, "Crowbar needed", 3)
				return
			end
		end
	end	
end)

I’ve added a note right next to the part where I move them.
I’d really appreciate it if anyone could help me!

Thanks,
Shield

I managed to fix the problem. Here’s how I did it for those who want to know:

Instead of using HumanoidRootPart.Position, use HumanoidRootPart.CFrame

2 Likes

Hey! I had the same issue. Thank you for pointing this out!

1 Like