Issue with player Teleporter (CFrame/Position)

I’m using this script

script.Parent.Touched:Connect(function(h)
	local hum = h.Parent:FindFirstChild("Humanoid")
	if hum ~= nil then
		h.parent.HumanoidRootPart.Position = Vector3.new(-259.165, 60.178, 161.482)
	end
end)

A simple teleporter, works well but if i keep moving in the map the Server sees the Player PimaryPart on another part of the Map, making it collide to other things like Seats, Parts or Players.

How could i fix this?

From Server

1.PNG

From Client

2.PNG

1 Like

Nvm i fixed it.

Actually seems like the Vector3 doesn’t work well with Server-Client synergy so instead of Position using CFrame.New(Coordinates) the script works.

I would also use SetPrimaryPartCFrame() for this to avoid any future issues

I would recommend using another part for the teleport location instead of coordinates.

This can be achieved by:

local part = --The part to teleport to
h.parent.HumanoidRootPart.CFrame = part.CFrame