Hello fellow scripters! I am trying to make a pathfinding AI that goes to the target but not quite so the hitbox can hit it.
I have not been able to achieve this and here is what is happening : The Stardust Journey [IN-DEV] - Roblox Studio 2023-06-18 15-19-47
My code :
local BodyGyro = Instance.new("BodyGyro")
BodyGyro.Parent = Character.HumanoidRootPart
BodyGyro.P = 1000
while task.wait() do
if Target then
BodyGyro.CFrame = CFrame.new(Character.HumanoidRootPart.Position,Target.HumanoidRootPart.Position)
ComputePath(Character.HumanoidRootPart.Position, Target.HumanoidRootPart.Position + (Target.HumanoidRootPart.Velocity.Unit * 3), 4, 5.121, true, 10)
if Waypoints.Status == Enum.PathStatus.Success then
for i, v in pairs(Waypoints:GetWaypoints()) do
if v.Action == Enum.PathWaypointAction.Jump or v.Position.Y > Character.HumanoidRootPart.Position.Y then
Character.Humanoid.Jump = true
end
Character.Humanoid:MoveTo(v.Position)
VisualizePath(Waypoints)
end
end
end
end