I've made a small script that makes ragdolls fly upwards. It works but it leaves an error message and I cant figure out why.
[ERROR] RunString:11: Tried to use a NULL physics object!
1. ApplyForceCenter - [C]:-1
2. fn - RunString:11
3. unknown - addons/ulib/lua/ulib/shared/hook.lua:179
The error is getting spammed in console until I delete all existing ragdolls
My code:
hook.Add("Think", "Fly", function()
ent = ents:GetAll()
for k, v in pairs(ent) do
local isRagdoll = v:IsRagdoll()
if isRagdoll == true then
phys = v:GetPhysicsObject()
phys:ApplyForceCenter(Vector(0, 0, 900))
end
end
end)
Thanks in advance.