is there an alternative to humanoid:move() because its not working on r6 for me for some reason
There’s a humanoid:MoveTo() that seems to work for me. It works a little differently than humanoid:Move since MoveTo() causes the humanoid to walk to a position instead of just a direction.
none seemed to work for me i dont know the problem
Can you post your code so we can take a look at it? I use MoveTo() and it does work.
could we see the properties of the humanoid?
Use Humanoid:MoveTo( Vector3 ). If the model doesn’t move, it could be anchored
Or it could have a part that’s anchored. I’ve had that happen to me before.
Move()
and MoveTo()
are completely two different things with different behaviors. Move()
utilizes a direction to move the humanoid, while MoveTo()
utilizes a position to move the humanoid.
Move()
You can use Move()
to tell a humanoid to move forward, backward, rightward, leftward, and etc… It does not go towards a specific position, instead it goes toward a direction. You can use things like CFrame.Unit
for the direction.
MoveTo()
You can use MoveTo()
to tell a humanoid to go to a specific Vector3 (Vector3.new(15,1,69), Vector3.new(-278,6,15), etc.).
The OP is saying that neither one is working for a R6 rig type.
Oh sorry, my bad.
In that case, he probably messed something up with his rig (HumanoidRootPart is anchored, it is not rigged correctly, etc.)
sorry for being ooffline for a while @Maelstorm_1973 @Downrest
this is my code:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local humanoid = script.Parent
local root = humanoid.Parent.HumanoidRootPart
local targetDistance = 20
local stopDistance = 5
function findNearestPlayer()
local playerList = Players:GetPlayers()
local nearestPlayer = nil
local distance = nil
local direction = nil
for _, player in pairs(playerList) do
local character = player.Character
if character then
local distanceVector = (player.Character.HumanoidRootPart.Position - root.Position)
if not nearestPlayer then
nearestPlayer = player
distance = distanceVector.Magnitude
direction = distanceVector.Unit
elseif distanceVector.Magnitude < distance then
nearestPlayer = player
distance = distanceVector.Magnitude
direction = distanceVector.Unit
end
end
end
return nearestPlayer, distance, direction
end
RunService.Heartbeat:Connect(function()
local nearestPlayer, distance, direction = findNearestPlayer()
if nearestPlayer then
if distance <= targetDistance and distance >= stopDistance then
print(direction)
humanoid:Move(direction)
else
humanoid:Move(Vector3.new())
end
end
end)
it is from a tutorial and it is a serverscript inside humanoid
when you say it does not work do you mean like it doesnt move or it just glitches of something like that
So you are trying to find the closest player and chase them? If so, then you need to use the pathfinding service. I have an answer that should help you with the basics.
Beyond that, check your rig and make sure that none of the parts are anchored. That will cause a problem.
it doesnt move, thats my problem
some parts were anchored. thanks bro