Humanoid:MoveTo() walks to wrong position

When I use the MoveTo function the player walks to a different position then the part position that I said it has to move to. It doesn’t matter wich part I use, it always walks to the same location.

for i,plr in pairs(game.Players:GetChildren()) do
    coroutine.wrap(function() -- let every player do the action at once
		local Position = game.Workspace.Lobby.Position1
		plr.character.Humanoid:MoveTo(Vector3.new(Position.Position))
		plr.character.Humanoid.MoveToFinished:Wait()
	end)()				
end

The problem is that you set a Vector3 value 2 times, just put it like this:

for i ,plr in pairs(game.Players:GetChildren()) do
    coroutine.wrap(function() -- let every player do the action at once
		local Position = game.Workspace.Lobby.Position1
		plr.character.Humanoid:MoveTo(Position.Position)
		plr.character.Humanoid.MoveToFinished:Wait()
	end)()				
end
1 Like

Yeah you are right about this I tested it in another test place but in the game I am working on it doesn’t work and I don’t know why

for i,plr in pairs(game.Players:GetChildren()) do
coroutine.wrap(function() -- let every player do the action at once
	if plr.PlayerNumber.Value == 1 then
		plr.character.Humanoid:MoveTo(Vector3.new(game.Workspace.BombFall.StartPos1.Position))
		plr.character.Humanoid.MoveToFinished:Wait()
		plr.Character.HumanoidRootPart.Orientation = plr.Character.HumanoidRootPart.Orientation+Vector3.new(0,180,0)
	end
	if plr.PlayerNumber.Value == 2 then
		plr.character.Humanoid:MoveTo(Vector3.new(3.979, 0.499, -20.685))
		plr.character.Humanoid.MoveToFinished:Wait()
		plr.Character.HumanoidRootPart.Orientation = plr.Character.HumanoidRootPart.Orientation+Vector3.new(0,180,0)
	end
	if plr.PlayerNumber.Value == 3 then
		plr.character.Humanoid:MoveTo(Vector3.new(-35.621, 0.499, 17.415))
		plr.character.Humanoid.MoveToFinished:Wait()
		plr.Character.HumanoidRootPart.Orientation = plr.Character.HumanoidRootPart.Orientation+Vector3.new(0,180,0)
	end
	if plr.PlayerNumber.Value == 4 then
		plr.character.Humanoid:MoveTo(Vector3.new(-36.121, 0.499, -20.885))
		plr.character.Humanoid.MoveToFinished:Wait()
		plr.Character.HumanoidRootPart.Orientation = plr.Character.HumanoidRootPart.Orientation+Vector3.new(0,180,0)
	end
end)()

end

this is the part of the script but I am player one so the rest doesn’t matter and startpos1 is the position in the upper left corner

robloxapp-20210719-1909408.wmv (536,6 KB)

Does it give any errors? Cause I’m seeing some mistakes, but not sure if they affect

no it does not give any errors

Maybe try this, but if it doesn’t work, make sure PlayerNumber’s value is changing, also is this a LocalScript or a Server Script?

for i,plr in pairs(game.Players:GetChildren()) do
coroutine.wrap(function() -- let every player do the action at once
	if plr.PlayerNumber.Value == 1 then
		plr.Character.Humanoid:MoveTo(Vector3.new(game.Workspace.BombFall.StartPos1.Position))
		plr.Character.Humanoid.MoveToFinished:Wait()
		plr.Character.HumanoidRootPart.Orientation = plr.Character.HumanoidRootPart.Orientation+Vector3.new(0,180,0)
	end
	if plr.PlayerNumber.Value == 2 then
		plr.Character.Humanoid:MoveTo(Vector3.new(3.979, 0.499, -20.685))
		plr.Character.Humanoid.MoveToFinished:Wait()
		plr.Character.HumanoidRootPart.Orientation = plr.Character.HumanoidRootPart.Orientation+Vector3.new(0,180,0)
	end
	if plr.PlayerNumber.Value == 3 then
		plr.Character.Humanoid:MoveTo(Vector3.new(-35.621, 0.499, 17.415))
		plr.Character.Humanoid.MoveToFinished:Wait()
		plr.Character.HumanoidRootPart.Orientation = plr.Character.HumanoidRootPart.Orientation+Vector3.new(0,180,0)
	end
	if plr.PlayerNumber.Value == 4 then
		plr.Character.Humanoid:MoveTo(Vector3.new(-36.121, 0.499, -20.885))
		plr.Character.Humanoid.MoveToFinished:Wait()
		plr.Character.HumanoidRootPart.Orientation = plr.Character.HumanoidRootPart.Orientation+Vector3.new(0,180,0)
	end
end)()

Same results, Does it has something to do with my game then? because in my testplace it does work

Probably yes, can you show me the script that changes PlayerNumber’s value?

-- Teleporting Players to position in lobby
Players.PlayerAdded:Connect(function(player)
	local NumberPlayers = game.Players:GetChildren() -- getting the Number of Players
	player.CharacterAdded:Wait()
	wait()
	
	local PlayerNumber = Instance.new("NumberValue")
	PlayerNumber.Name = "PlayerNumber"
	PlayerNumber.Parent = player
	
	local Death = Instance.new("BoolValue")
	Death.Name = "Death"
	Death.Parent = player
	
	if #NumberPlayers == 1 then
		PlayerNumber.Value = 1
		player.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Lobby.Position1.Position)
	end
	if #NumberPlayers == 2 then
		PlayerNumber.Value = 2
		player.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Lobby.Position2.Position)	
	end	
	if #NumberPlayers == 3 then
		PlayerNumber.Value = 3
		player.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Lobby.Position3.Position)	
	end	
	if #NumberPlayers == 4 then
		PlayerNumber.Value = 4
		player.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Lobby.Position4.Position)	
	end	

	game.ReplicatedStorage.ChangeCameraOfPlayer:FireClient(player, "Scriptable", game.Workspace.StartCamera)	-- change camera of player that joined
	
end)

normally this isn’t the problem because I have tested this enough and it does save the correct Number of the player

MoveTo only make the character walk for a few seconds max.

Yeah I know but that is not the problem, it is not a far distance or anything. If I use the exact coordinates it will let the player move to that location but if I use the location of a part then it moves the player to the wrong location