You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
A bar that goes down every second, and every second the text changes to display the number value of whats left of it.
What is the issue? Include screenshots / videos if possible!
The text will not change
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Everything bro
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local MaxStamina = 100
local char = script.Parent
local plr = game.Players.LocalPlayer
local Stamina = MaxStamina
local Amount = game.StarterGui.StaminaBar.StaminaBackround.Amount
while wait(1) do
Stamina -= 1
print(Stamina)
plr.PlayerGui.StaminaBar.StaminaBackround.StaminaBar2:TweenSize(UDim2.new(Stamina / MaxStamina, 0,1,0))
Amount.Text = Stamina.. "/" ..MaxStamina
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
You’re attempting to change the Text property of Amount directly. Amount is a reference to a UI element and not the actual TextLabel itself. You need to access the TextLabel component within Amount and then update its Text property
It’s because you are changing the Template of the ui.
You could do;
local MaxStamina = 100
local char = script.Parent
local plr = game.Players.LocalPlayer
local Stamina = MaxStamina
local Amount = plr.PlayerGui:WaitForChild("StaminaBar").StaminaBackround.Amount
while wait(1) do
Stamina -= 1
print(Stamina)
plr.PlayerGui.StaminaBar.StaminaBackround.StaminaBar2:TweenSize(UDim2.new(Stamina / MaxStamina, 0,1,0))
Amount.Text = Stamina.. "/" ..MaxStamina
end