I am trying to make a stamina bar lower when the player runs in this case. The code I am using is this:
game.ReplicatedStorage.RemoteEvent:FireServer()
game:GetService("UserInputService").InputBegan:Connect(function(input, event)
local StaminaFrame = game.Players.LocalPlayer.PlayerGui.VisibleStatus.Frame.Stamina.Frame.Frame
local Level = game.Players.LocalPlayer:WaitForChild("Stats").Level
local Stamina = game.Players.LocalPlayer:WaitForChild("Stats").Stamina
local StaminaMax = Stamina.Value*Level.Value
local StaminaMin = 0
if input == Enum.KeyCode.W and input == Enum.KeyCode.LeftShift then
StaminaFrame.Size = UDim2.new(Stamina.Value/StaminaMax, 0, 1, 0)
end
end)
I need help with the "StaminaFrame.Size = UDim2.new(Stamina.Value/StaminaMax, 0, 1, 0)" part. It doesn't seem to work as needed and I am not skilled enough to find a solution. If any of ya'll could help, that would be very nice of you. Thanks in advance.

1 comment
Thank you very much, it works with some slight edits.