Hello, I was wondering how I prevent my AI monster from falling over. For example, it might trip over something and walk inside of the ground before flinging back up or when it jumpscares the player it might fall over and ruin the jumpscare.
This really breaks immersion and makes the game low quality. How do I prevent my monster from falling over? like how could I just compeltely remove the physics or something?
if debounceEverything == false then
local plrChar = plr.Character
local plrRoot = plrChar.HumanoidRootPart
if not jumpScaring then
hum.WalkSpeed = 16
chasing = true
idling = false
investigating = false
local PathfindingService = game:GetService("PathfindingService")
local path = PathfindingService:CreatePath(CustomPathfindingParameters)
local pathconnection = nil
while chasing and debounceEverything == false do
if checkIfSee(plr) == false then
ShouldContinue = true
if path.Status == Enum.PathStatus.Success then
local waypoints = path:GetWaypoints()
for _, waypoint:PathWaypoint in waypoints do
local distanceFromLastWaypoint = (waypoints[#waypoints].Position - plrRoot.Position).Magnitude
if distanceFromLastWaypoint < 30 then
pathconnection = path.Blocked:Connect(function()
ShouldContinue = false
if ShouldContinue == false then
print("Broken due to obstruction")
pathconnection = nil
elseif path.Status == Enum.PathStatus.NoPath then
chasing = false
investigating = false
else -- We can see the player, why pathfind when we can run straight at them
RunService.Stepped:Wait() -- Wait to prevent Script timeout
To prevent your AI monster from falling over, you can use the Humanoid.AutoRotate property. By default, this property is set to true , which means the humanoid will automatically stand upright. If you set this property to false , the humanoid will no longer try to stay upright, and as a result, won’t be affected by gravity, effectively not falling over.
hum.AutoRotate = false
However, you might not want your monster to completely ignore physics because that could lead to unrealistic movements. You might want to use some physical properties to help stabilize your monster, for example, you can add a BodyGyro object to your humanoid’s root part to help it stay upright.
local bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vector3.new(0, math.huge, 0) -- this ensures your monster only rotates around the Y-axis
bodyGyro.CFrame = CFrame.new(monster.HumanoidRootPart.Position)
bodyGyro.Parent = monster.HumanoidRootPart
You also have to make sure your monster does not collide with small objects that might make it trip. You can do this by setting its Humanoid.StepHeight to a sufficiently high value.
hum.StepHeight = 5
This will allow your monster to step over any object that is 5 or fewer studs tall, preventing it from tripping over small obstacles. Adjust this value as needed for your game.
You should also adjust and add some things but since I do not know the details and the game and cannot help you further. hope It helps