It stops when it hits... if pos.Value == "0" then on line 12.. I know it's correct but it doesn't go through.. No errors or anything like that.
GUI = script.Parent Player = game.Players.LocalPlayer mouse = Player:GetMouse() pos = script.Parent.Pos debounce = true function keydown(key) print(key) key = key:lower() print(key) if key == "q" then if pos.Value == "0" then if debounce == true then print(debounce) debounce = false print(debounce) GUI:TweenPosition(UDim2.new(1, -100, 1, -100), "Out", "Elastic") pos.Value = "1" else GUI:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Elastic") pos.Value = "0" print(debounce) end debounce = true end end end mouse.KeyDown:connect(keydown)
If pos is an integer value then you don't need to include the quotation marks around the number. pos.Value == "1"
is pretty much asking if the value of pos is a string 1 not a number 1. You would use pos.Value == 1
to check to see if it's equal to 1. I have fixed it for you.
GUI = script.Parent Player = game.Players.LocalPlayer mouse = Player:GetMouse() pos = script.Parent.Pos debounce = true function keydown(key) print(key) key = key:lower() print(key) if key == "q" then if pos.Value == 0 then if debounce == true then print(debounce) debounce = false print(debounce) GUI:TweenPosition(UDim2.new(1, -100, 1, -100), "Out", "Elastic") pos.Value = 1 else GUI:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Elastic") pos.Value = 0 print(debounce) end debounce = true end end end mouse.KeyDown:connect(keydown)