RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make it so if there is something in your way you jump"
local pfs = game:GetService("PathfindingService") local player = game.Players.LocalPlayer local closestPlayer = nil while true do for _, otherPlayer in pairs(game.Players:GetPlayers()) do if otherPlayer ~= player then if closestPlayer == nil or (otherPlayer.Character.PrimaryPart.Position - player.Character.PrimaryPart.Position).magnitude < (closestPlayer.Character.PrimaryPart.Position - player.Character.PrimaryPart.Position).magnitude then closestPlayer = otherPlayer end end end local path = pfs:CreatePath() path:ComputeAsync(player.Character.PrimaryPart.Position, closestPlayer.Character.PrimaryPart.Position) for _, waypoint in pairs(path:GetWaypoints()) do local ray = Ray.new(player.Character.PrimaryPart.Position, (waypoint.Position - player.Character.PrimaryPart.Position).unit * 5) local part, position = workspace:FindPartOnRayWithIgnoreList(ray, {player.Character.PrimaryPart}) if part then player.Character.Humanoid:Jump() end player.Character.Humanoid:MoveTo(waypoint.Position) player.Character.Humanoid.MoveToFinished:Wait() end wait(1) end