repeat wait() until game.Players.LocalPlayer GUI = script.Parent.Parent Player = game.Players.LocalPlayer mouse = Player:GetMouse() inuse = script.Parent debounce = true function keydown(key) key = key:lower() if key == "q" and debounce == true then debounce = false if inuse.Value == "No" then debounce = false GUI:TweenPosition(UDim2.new(0.5, -350, 0.5, -150), "Out", "Elastic") inuse.Value = "Yes" elseif inuse.Value == "Yes" then GUI:TweenPosition(UDim2.new(0, -1500, 0, 0), "Out", "Elastic") inuse.Value = "No" end debounce = true end end mouse.KeyDown:connect(keydown)
this is my current script.. Everything works.. Just need it to be a bit more.. efficient? Any way I can do this?
I don't see much of anything that you could change that would make it more efficient, I will make one change though.
repeat wait() until game.Players.LocalPlayer GUI = script.Parent.Parent Player = game.Players.LocalPlayer mouse = Player:GetMouse() inuse = script.Parent debounce = true mouse.KeyDown:connect(function(key) -- Made connection line and function one line key = key:lower() if key == "q" and debounce == true then debounce = false if inuse.Value == "No" then debounce = false GUI:TweenPosition(UDim2.new(0.5, -350, 0.5, -150), "Out", "Elastic") inuse.Value = "Yes" elseif inuse.Value == "Yes" then GUI:TweenPosition(UDim2.new(0, -1500, 0, 0), "Out", "Elastic") inuse.Value = "No" end debounce = true end end)