So I am practicing my scripting because I just learned Tweening. I tried to make an Inventory script where you press the letter "e" on your keyboard and the GUI comes down to the middle where you can see it but when I press "e" on my keyboard, the GUI won't show up. The output supposedly doesn't say that there is an error... Did I make any mistake in my script? (Down Below)
Script:
player = game.Players.LocalPlayer if player:GetMouse().KeyDown == "e" then -- High Position of Frame: {0.068, 0},{-0.781, 0} -- Middle Position of Inventory: {0.068, 0},{0.077, 0} Inventory = script.Parent.Inventory Inventory.Visible = true Inventory:TweenPosition{ UDim2(0.068, 0, 0.077, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, false } end
Mouse has been superseded by UserInputService and ContextActionService. Always refer to API reference pages to keep up to date with things.
local userInputService = game:GetService("UserInputService") local Inventory = script.Parent.Inventory userInputService.InputBegan:Connect(function(input) if input.KeyCode = Enum.KeyCode.E then Inventory.Visible = true Inventory:TweenPosition{ UDim2.new(0.068, 0, 0.077, 0), --your original script would've worked, all you were missing was .new after UDim2 Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, false } end end)