Keypress Event not working... What is my error? (updated)
Asked by
4 years ago Edited 4 years ago
My old question was answered but it still wouldn't work. The script the person who answered my question gave me had some errors so I changed it but now I "Attempted to call a nil value." Can anyone point out what my error was please? Please check the script below. Thank you for your time.
Script:
01 | local userInputService = game:GetService( "UserInputService" ) |
02 | local Inventory = script.Parent:GetChildren( "Inventory" ) |
04 | userInputService.InputBegan:Connect( function (input) |
05 | if input.KeyCode = = Enum.KeyCode.E then |
06 | Inventory.Visible = true |
07 | Inventory:TweenPosition { |
08 | UDim 2. new( 0.068 , 0 , 0.077 , 0 ), |
09 | Enum.EasingDirection.Out, |
10 | Enum.EasingStyle.Quad, |