Hello, is there a way to freeze a Moving Ai without putting speed to 0 and without Anchoring HumanoidRootPart? if i anchor HumanoidRootPart it messes up the Ai, if i put the speed to 0 its gonna still move cuz i have a sprint system for it
Really dumb way of doing it could possibly be using Humanoid:MoveTo() and then just move to the current position that the HumanoidRootPart is at.
For example, if the HumanoidRootPart is at (12, 1.34, 48.5) then you could just do
Humanoid:MoveTo(HumanoidRootPart.Position)
Sounds like you’re trying to find a workaround instead of editing your sprint system to account for a frozen Humanoid. WalkSpeed = 0 and Anchored = true are pretty much the only ways you should be keeping a Humanoid from moving. Everything else would be just a “hack”.
--the physics way
local force = 9999999
function SetPhysicsAnchor(part, value)
if value then
local BodyPos = Instance.new("BodyPosition")
BodyPos.Position = part.Position
BodyPos.P = force
BodyPos.MaxForce = Vector3.new(force, force*workspace.Gravity, force)
BodyPos.Name = "PositionAnchor"
local BodyRot = Instance.new("BodyGyro")
BodyRot.P = force
BodyRot.CFrame = part.CFrame
BodyRot.MaxTorque = Vector3.new(force, force*workspace.Gravity, force)
BodyRot.Name = "RotationAnchor"
BodyPos.Parent = part
BodyRot.Parent = part
else
local pos = part:FindFirstChild("PositionAnchor")
local rot = part:FindFirstChild("RotationAnchor")
if pos then
pos:Destroy()
end
if rot then
rot:Destroy()
end
end
end
SetPhysicsAnchor(Player.Character.HumanoidRootPart, true)
local LocalPlayer = game:GetService("Players").LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
Controls:Disable()
This will prevent the player from moving without changing any physical property
That only works for actual players, according to them, they look for a way to freeze AI.
Ahhh ok i didn’t understand he was talking about AI (npcs right?)
Yeah I agree. You should be doing this in the AI script.
.