so here's the code:
local ply = game.Players.LocalPlayer
local gui = ply:WaitForChild('PlayerGui'):WaitForChild('ScreenGui'):WaitForChild('Inventory')
local InventoryOpened = false
function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
print("E was pressed")
if InventoryOpened == false then
gui:TweenPosition(UDim2.new({0.15, 0},{0.2, 0}), "InOut", "Quad", 1, true)
InventoryOpened = true
else
print('should close here')
gui:TweenPosition(UDim2.new({0.15, 0},{1, 0}), "InOut", "Quad", 1, true)
InventoryOpened = false
end
end
end
game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.E)
The 'Inventory' gui should move to {0.15, 0},{0.2, 0} but for some reason it moves to {0, 0},{0,0}. Also, the gui doesn't close when I press 'E' again.
Any help would be appreciated.

1 comment
Should it not be Gui:TweenPosition(UDim2.new(0.15, 0.2, 0, 0)) ?