function onKeyPress(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then game.StarterGui.uh.ImageLabel.ImageTransparency = 0 end end game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.E)
Everything works no error just doesn't perform...
You problem is that you are trying to access ContextActionService
as if it were a member of game
when in reality it is actually a service that need to be retrieved before it can be used.
In order to retrieve it, you can use the method of game :GetService()
:
local contextAction = game:GetService("ContextActionService") function onKeyPress(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then game.StarterGui.uh.ImageLabel.ImageTransparency = 0 end end contextAction:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.E)