I am currently trying to spawn a wave of humanoid controlled NPCs. They are spawned above ground, have Ragdoll and FallingDown set to false, and they do not collide with each other. However they are still unsteady and unpredictable. Does anyone have any solutions to prevent humanoid controlled NPCs from flinging off the map? I would greatly appreciate it!
Thanks,
Anne
Side note:
I only recently set Ragdoll and FallingDown to false based on another forum post I had read: Best way of preventing humanoid tripping? However, this did not help
In my games 99% of flings are ridiculously powerful, but they also happen relatively rarely.
In cases where characters are flinged extremely hard you could:
A) Reset their character
B) Try to set velocity and rotvelocity to 0
I personally do fling detection on every RenderStepped tick like this:
local function FlingPreventionUpdate()
if CurrentHum ~= nil and CurrentRoot ~= nil and Force ~= nil then
if CurrentRoot:IsDescendantOf(Workspace) then
if CurrentRoot.RotVelocity.magnitude >= 50 or CurrentRoot.Velocity.magnitude >= 50 then
CurrentRoot.RotVelocity = Vector3.new()
CurrentRoot.Velocity = Vector3.new()
print("Fling prevented")
end
end
end
end
My game doesn’t have high places so players would not reach high velocities while falling down. In games where people could fall down tall places, you can just exclude the Y velocity and check (velocity - Vector3.new(0, velocity.y,0)).magnitude
Though this is for client humanoids XD…
If flings are too often, then there might be tons of reasons why it’s happening. My guess is that collidable character limbs might be forced into map parts by animations.