Hi.
- What do you want to achieve?
- Make a Character that follows the player ( start in the script ) in the Module Script.
- What is the issue?
- When I run this ( on floppa that has Humanoid and HumanoidRootPart ) floppa will be stuck in part and won’t move even though I’m next to floppa.
- What solutions have you tried so far?
- I did a search on the Roblox Dev forum but I didn’t find anything that did help.
Module Script:
function module.FollowPlayerAI(start, radius)
while true do
local player = module.FindNearestPlayer(start, radius) -- (finds the nearest player that has Humanoid, HumanoidRootPart, and Head) return Player Character (Model)
local humanoid = module.CheckHumanoid(start) -- (check if start has humanoid and HumanoidRootPart or if start's Parent has humanoid and HumanoidRootPart) return Humanoid
if not humanoid or not player then return end
local path, Waypoints = module.MakePath(start, player) -- make a path and returns Path and Waypoints
for i, waypoint in pairs(Waypoints) do
humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
wait()
end
end
Script:
local module = require(game.ReplicatedStorage.MainModule)
module.FollowPlayerAI(script.Parent, nil) -- if the radius is nil then the radius is math.huge