I want to run a check to see if I can move a humanoid without using pathfinding and instead just use MoveTo(). How would I accomplish this? This is to prevent lag. Thanks - lux
To check if a humanoid can move without using pathfinding in Roblox, you can use the “MoveTo” function in combination with the “PathfindingEnabled” property. Here’s an example code:
local humanoid = game.Workspace.Humanoid -- Change this to your humanoid object local destination = Vector3.new(10, 0, 0) -- Change this to your desired destination -- Check if pathfinding is enabled if humanoid.PathfindingEnabled then -- If pathfinding is enabled, use MoveTo function humanoid:MoveTo(destination) else -- If pathfinding is not enabled, use a simpler movement method humanoid:Move(destination - humanoid.RootPart.Position) end
Don’t use ChatGPT to generate answers, please.
PathfindingEnabled both do not exist as properties and methods for the
Humanoid class. All you’re doing is hoping OP is too naive to check your solution and just blindly marks it as the real one.
To check if the Humanoid can reach a target without the use of pathfinding, you’re going to have to check if the path is clear. There are many ways you can do this (such as with an A* algorithm), but the simplest solution is just to check if the path is obstructed by using a Raycast that comes from the humanoid’s head and aims towards the destination.
For pits and other things, you’ll have to be more complex, and of course you’d just use pathfinding for this at that point.
sure, next time i will says instead of dont said anything
Hopefully Roblox can address this issue in the future to prevent misleading or unintentionally plagiaristic answers. I Hate to see it go in that direction at all.