Troubles getting a script to work
I am trying to create a script similar to a lot of prop hunts' unstuck script where it teleports your forward a bit. But I can't seem to find a decent tutorial anywhere on player scripting in lua. Could I get some help on the subject?
This is my current script
Code:
local TeleHack = {}
TeleHack.Version = "0.1.0"
TeleHack.Ply = LocalPlayer()
TeleHack.KeyPressed = function(key)
local trace = LocalPlayer:GetEyeTraceNoCursor();
if key == 34 then //34 = X key
Ply:SetPos(trace.HitPos + trace.HitNormal * 32);
print( "returned true" )
return true
end
print( "returned false" )
return false
end
I'm testing this in a single player environment at the moment and my console says "Running script TeleHack.lua...
A" but when I press my X key I don't get any prints/errors in the console. How come the keypressed function is not being called?