Making a player walk to a part

hey! I’m current wondering how to make a player walk to a part.

2 Likes

You have to use Humanoid:MoveTo

Simply use ‘Humanoid:MoveTo’.

You might want to use 'Humanoid.MoveToFinished` aswell to prevent issues if you have multiple parts to approach.

Example:

local parts = game.Workspace.Parts:GetChildren()

local Humanoid = script.Parent

for _,part in pairs(parts)
    Humanoid:MoveTo(part.Position)
    Humanoid.MoveToFinished:Wait()
end
2 Likes

im currently using this, but it says that it indexed nil with name

function CookingModule.WalkToFridge(destination, player)
	local Humanoid = script.Parent
	
	workspace:FindFirstChild(game.Players.LocalPlayer.Name).Humanoid:MoveTo(destination.Position)
	Humanoid.MoveToFinished:Wait()
end
1 Like

You cant use LocalPlayer in a server script

Do you know what I would use instead?

skim thru one of these, u’ll be chillin’ like kanye west

also, question. it works, but when the player’s speed is set to 0, it won’t move. can u help me make it so that when the speed is 0, the player still moves.

1 Like