local UIS = game:GetService("UserInputService")
TabKeyPressed = false
UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if input.Keycode == Enum.KeyCode.Tab then
TabKeyPressed = true
while TabKeyPressed == true do
script.Parent:TweenPosition(UDim2.new(0.031, 0,0.488, 0),"Out","Sine",1)
end
end
end)
UIS.InputEnded:Connect(function(input, gameProcessedEvent)
if input.Keycode == Enum.KeyCode.Tab then
TabKeyPressed = false
while TabKeyPressed == false do
wait(1)
script.Parent:TweenPosition(UDim2.new(-0.711, 0,0.494, 0),"In","Sine",1)
end
end
end)Preformatted text
Im trying to make a gui close and open when tab{key} is being pressed.