The Wiki says I can record key presses in a table to determine whether the key is being held or not, so something like
local keys = {}
mouse.KeyDown:connect(function(key)
keys[key] = true
end)
mouse.KeyUp:connect(function(key)
keys[key] = nil
end)
while wait(0.1) do
if keys["q"] and Tool.Val.Value > 0 then
Tool.Val.Value = Tool.Val.Value - 5
elseif keys["e"] and Tool.Val.Value < 200 then
Tool.Val.Value = Tool.Val.Value + 5
end
end
However, I'd also like to differentiate between a key press and someone holding down the key, and while the script is effective enough at doing that, it only checks for key presses every 1/10th of a second, so anytime someone pushes a key in that 10th of a second it won't count. It's minor, yeah, but I'd really like to find a more concise method of determining keystrokes from key presses.

1 comment
Since this is a LocalScript, RenderStepped could be used as well, which is the true minimum wait time on the Client.