Script Broken Please Help

idk charachter limit eeeeeeeeeeeeeeeeeeeeeeee

Are the errors still empty? No warnings or anything? Add print statements into the following piece of code:

while true do
if not Running and Stamina < 100 then
Stamina = math.min(Stamina + 0.5, 100)
StaminaBar:TweenSize(UDim2.new(Stamina / 100, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.1, true)
end
wait(0.1) – Adjust the wait time as needed
print(Stamina, StaminaBar.Size)
end

can you show me the completed script with that in it

It would be

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local UserInputService = game:GetService(“UserInputService”)

local Stamina = 100
local Running = false
local SprintSpeed = 30
local WalkSpeed = 16

– Make sure the UI elements exist before referencing them
local StaminaBar = script.Parent.StaminaBar.Bar
local HealthBar = script.Parent.HealthBar.Bar

– Set initial UI sizes
StaminaBar.Size = UDim2.new(1, 0, 1, 0)
HealthBar.Size = UDim2.new(1, 0, 1, 0)

– Update the health bar when the Humanoid’s Health changes
Character:WaitForChild(“Humanoid”).Changed:Connect(function(property)
if property == “Health” then
HealthBar.Size = UDim2.new(Character.Humanoid.Health / 100, 0, 1, 0)
end
end)

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
– Make sure the input isn’t processed by other UI/game systems
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.LeftShift then
Running = true
Character.Humanoid.WalkSpeed = SprintSpeed
end
end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.LeftShift then
Running = false
Character.Humanoid.WalkSpeed = WalkSpeed
end
end
end)

– Stamina regeneration loop
while true do
if not Running and Stamina < 100 then
Stamina = math.min(Stamina + 0.5, 100)
StaminaBar:TweenSize(UDim2.new(Stamina / 100, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.1, true)
end
wait(0.1) – Adjust the wait time as needed
print(Stamina, StaminaBar.Size)
end

This prints the stamina and size.