KeyDown/KeyPressed

they are not working?

You are using them wrong, post code.

right from the wiki
local players = player.GetAll()
for _, player in ipairs( players ) do
if( player:KeyPressed( IN_FORWARD ) ) then
Msg( "You pressed the forward key!
" )
end
end

First of all use lua tags.

Second of all, you need to run that every Think for it to work. If you run the command while not holding the forward button, it will not print anything.

Last time I checked KeyPressed didn’t work

[editline]10:35AM[/editline]

Also your tabbing is terrible

[editline]10:36AM[/editline]

[lua]
local players = player.GetAll()
for _, player in ipairs( players ) do
if( player:KeyPressed( IN_FORWARD ) ) then
Msg( "You pressed the forward key!
" )
end
end
[/lua]

It’s not his tabbing, he said he got it from the wiki.

Its because any tabs are lost without lua or code tags

[lua]
hook.Add(“Think”,“SomeRandomKeyPressThink”,function()
for _, player in pairs( player.GetAll() ) do
if( player:KeyPressed( IN_FORWARD ) ) then
print( “You pressed the forward key!” )
end
end
end)
[/lua]

Used a think hook so now it checks every think.

Print should be >print< and not >Print<

Soo print( “You pressed the forward key!” )

This code works for me.