How do I use MoveTo() to move a player?

Heres the script:

local name = workspace.vote.eins.map.Value
		local wiat = game.ServerStorage.maps:WaitForChild(name)
		local clone = wiat:Clone()
		clone.Parent = game.Workspace.workmap

		local text = workspace.status.SurfaceGui.TextLabel
		text.Text = "Status: Voting ended"
		wait(2)
		for count = 5,0,-1 do
			local text = workspace.status.SurfaceGui.TextLabel
			text.Text = "Status: Game starting in ".. count .." seconds!"
			wait(1)
		end
		local p = game.Players:GetChildren()
		local maps = workspace.workmap:WaitForChild(name)
		local pos = workspace.workmap[workspace.vote.eins.map.Value].teleport.Part.Position
		for i = 1, #p do
			workspace[p[i].Name]:MoveTo(Vector3.new(pos))
		end

Heres the part where I have the issue:

for i = 1, #p do
			workspace[p[i].Name]:MoveTo(Vector3.new(pos)) -- <<< right here
		end

No output errors, but it moves the players to 0,0,0.

This is not the full script, so variables might not make sense.

MoveTo() can only be used on a Player, not a Character. (Or at the inverse)

try this;

local p = game.Players:GetChildren()
		local maps = workspace.workmap:WaitForChild(name)
		local pos = workspace.workmap[workspace.vote.eins.map.Value].teleport.Part.CFrame
		for i = 1, #p do
			p[i].Character:SetPrimaryPartCFrame(pos * CFrame.new(0,3,0))
		end
2 Likes

Huh, did not know you needed to do SetPrimaryPartCFrame() to move a player, but here we are. Thank you

1 Like