This is something I have never asked about because it feels like the most basic thing in Lua and I’d be an idiot not knowing how to do it. But I have looked through other peoples scripts, searched everywhere and tried doing this myself hundreds of times and never succeeded in making it work. I would be so thankful if someone could help me with this.
What I’m currently trying to do is making the key T enable thirdperson for the one who presses it without spamming it due to input.IsKeyDown. Here is the current(unfunctional) code for it.
local ply = LocalPlayer() local ply.Keylock = false function Buttons_USED() if not ply.Keylock then if input.IsKeyDown(KEY_T) then ply:ConCommand("thirdpersontoggle") ply.Keylock = true end end end