Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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")
03 
04    userInputService.InputBegan:Connect(function(input)
05        if input.KeyCode == Enum.KeyCode.E then
06            Inventory.Visible = true
07            Inventory:TweenPosition{
08            UDim2.new(0.068, 0, 0.077, 0),
09            Enum.EasingDirection.Out,
10            Enum.EasingStyle.Quad,
11            0.5,
12            false
13        }
14    end
15end)
0
does inventory exist with how you find it?? if not, thats what the script is telling you.... also the script looks like you cut out some things, i suggest you give the full script so we can make the best of analysis speedyfox66 237 — 4y
0
Try replacing line 2 with local Inventory = script.Parent:WaitForChild("Inventory") LeedleLeeRocket 1257 — 4y
0
The Inventory exists inside the ScreenGui FilipinoWrld 22 — 4y

Answer this question