Basically, I’ve got an entity, and the ENT:Use() code is firing an average of 13 times each time you press E on it, I want it to only fire once. In ROBLOX we used a process called debouncing, where you could throw in a wait(num) function to have it disabled for a time, but I noticed in gmod lua there’s no such function, so is there a way I could make a debounce or a way I could stop it from firing 13 times?
Code in ENT:Use() :
function ENT:Use(activator, caller)
if activator:IsPlayer() then
player = activator;
if nexus.player.CanAfford(player, 5) then
nexus.player.GiveCash(player, -5, “Bought a coke”, false)
nexus.inventory.Update(player, “Coke”, 1, true);