KeyDown function enables GUI???????????
I'm trying to implement a menu in my game, and I'm having trouble. I can't see whats wrong. Any help would be appreciated, thank you.
1 | function onKeyPress(inputObject, gameProcessedEvent) |
2 | if inputObject.KeyCode = = Enum.KeyCode.M then |
3 | game.Player.LocalPlayer.PlayerGui.Menu.Enabled = true |
7 | game:GetService( "UserInputService" ).InputBegan:connect(onKeyPress) |
(This is inside StarterPlayer.StarterPlayerScripts, and is a LocalScript)
Error:
1 | Script 'Players.jetpush123.PlayerScripts.LocalScript' , Line 3 |
2 | Player is not a valid member of DataModel |