Create a Countdown

Hello Everyone, my name is Drakosor677

So, I’m very “new” in this scripting world, and I wanted to create something like a
‘countdown’ wich starts in 0% till 100%.

But, the problem is: I can’t create one.

And worst of all, and this is why i come here, it’s because this code don’t work.

I Tried to desactivate all of my plugins, but it’s still not working.

I Tried to make the code more simpler, but nothing works.
Here’s an Example
I tried to create one but it looks very horrible.

I unfortunately, i don’t have amy screenshot to show.
But here’s an example:

local coutdown = game.StarterGui.coutdown

coutdown.TextLabel.Text = (“33%”)

wait (0.08)

coutdown.TextLabel.Text = (“34%”)

coutdown.TextLabel.Text = (“35%”)

wait (0.08)

If someone could help me, i really aprecciate.

Thanks!

1 Like

Simplest way of going about that is a localscript like this in the TextLabel

local textlabel = script.Parent

for i = 0, 100 do
	textlabel.Text = i.."%"
	wait(0.08)
end
5 Likes

Ah yes, welcome to the scripting world! Where we talk about the Matrix & CFRAME PAIN & all that complicated Stuff

I do see a couple of things that you can change:

  • Getting the StarterGui you referenced in your coutdown variable is actually being replicated to the server’s side, and not from yours

  • You can actually put the Text through a loop, then it’ll slowly progress through every time it’s repeated

  • Have you looked at how LocalScripts work? They can be used to easily get the PlayerGui that way

I’ll give an example:

local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local Countdown = PlayerGui:WaitForChild("coutdown")

for Progress = 1, 100 do
    wait(0.08)
    Countdown.TextLabel.Text = (Progress.."%")
end
1 Like