--itty bitty script that makes a robot jump when their charge meter is empty. local function removeCallbacks(player, callbacks) if not IsValid(player) then return end for _, callbackId in pairs(callbacks) do player:RemoveCallback(callbackId) end end function JumpOnChargeEmpty(_, activator) local callbacks = {} local check local terminated = false local Zvalue local function terminate() if terminated then return end terminated = true timer.Stop(check) removeCallbacks(activator, callbacks) end check = timer.Create(0.015, function() if not IsValid(activator) or not activator:IsAlive() then terminate() return end if activator.m_flChargeMeter == 0 then activator:RunScriptCode("activator SetAutoJump (0.1, 0.1)", activator) activator:RunScriptCode("activator SetAutoJump (9999, 9999)", activator) end end, 0) callbacks.died = activator:AddCallback(ON_DEATH, function() terminate() end) callbacks.removed = activator:AddCallback(ON_REMOVE, function() terminate() end) callbacks.spawned = activator:AddCallback(ON_SPAWN, function() terminate() end) end