My script only changes the gui once when i press Q and i dont know how to fix it
stamina = 100
local play = game.Players.LocalPlayer
local user = game:GetService("UserInputService")
local key = Enum.KeyCode.Q
local Orange = script.Parent
user.InputBegan:Connect(function(input,gameprocessed)
if input.UserInputType == Enum.UserInputType.Keyboard
and input.KeyCode == Enum.KeyCode.Q then
print(stamina)
stamina = stamina - 10
Orange.Size = UDim2.new(1 - 0.111 ,1,1,0)
if stamina < 100
then
wait(2)
stamina = stamina + 10
Orange.Size = UDim2.new(1 + 0.001 ,1,1,0)
if stamina == 100 then
end end end end)

3 comments
I only want it to preform when Q is pressed
Do you want it so this function only runs once? Since it seems that a player can just spam Q and make stamina drop well below zero
I want it so that everytime Q is pressed the gui changes size