Is it possible? textlabel countdown

hello. Am trying to make a text label count down to 0. I have a day and night cycle and so am trying to make a text label start at 700 then count down to 0. after that I want it to start over the countdown. I am also trying to make this a gamepass so you need a gamepass to see the text. Is it possible?

https://education.roblox.com/en-us/resources/adventure-game-monetization-game-passes

yeah for the gamepass am trying to make it so when you brought that gamepass. then you will see the text label?

for i = 700,0,-1 do
--put here what value you want to change.
wait(1)--every 1 second for i will remove 1 from value.
end

Am trying to make a text thats not visible to anyone. but if you brought the gamepass then it will be visible to you.

oh so add textlabel to ScreenGui and write this script in screenGui:

local id = 0000000 --remove this zeros and put your gamepass ID

game.Players.PlayerAdded:Connect(function(player)
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) then
    	script.parent.TextLabel.Visible=true
else
script.parent.TextLabel.Visible=false
    end
end)

yeah also for the script for a counting script how do i make it loop?

while true do
  for i = 700,0,-1 do
    --put here what value you want to change.
    wait(1)
  end
wait(0.01)
end

and do i put it as a script in the text label?

put it in workspace (just create new script and paste what i writed higher, im about loop.)

put the script for checking gamepass into ScreenGui.

nope it just saying label and not counting down.

oh yes im forgot
add this too:

while true do
script.Parent.TextLabel.Text=(workspace.PutValueName.Value)
wait(0.01)
end

1 Like

same script? or in different script?

create new script in ScreenGui and put it in.

i also have to create a value for it right?

right.

(I will create a place with what you needed you just can look inside and see where i putted it and i will create a folder in workspace and you must copy it to your place and place all how its named)

(if you dont want to read just add this folder to your place: The timer.rbxm (3.7 КБ)

)
First:adding what we need
1.Create new value in workspace and name its how you want.
2.Create new TextLabel in ScreenGui
3.Create 2 new scripts In ScreenGui
4.Create 1 new script in Workspace
Second:scripting
1.Open the 1 script in ScreenGui and put this:

local id = 0000000 --remove this zeros and put your gamepass ID

game.Players.PlayerAdded:Connect(function(player)
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) then
    	script.parent.TextLabel.Visible=true
else
script.parent.TextLabel.Visible=false
    end
end)

This script will check if player have gamepass and if player has this gamepass the text label will be visible.
Note: Change the zeros in first line to your gamepass id.

2.Open the 2 script and put this:

while true do
script.Parent.TextLabel.Text=(workspace.PutValueName.Value)
wait(0.01)
end

this script will add value value to TextLabel
Note:Change PutValueName in 2 line to your value name.

3.Open the script in workspace and put this:

while true do
  for i = 700,0,-1 do
    script.parent.PutValueName.Value=i
    wait(1)
  end
wait(0.01)
end

This script will count from 700 to 0 in value.
Note: Change PutValueName in 3 line to your value name.

1 Like

Timer works. but gamepass script doesn’t.

Hey there!
This is very possible and very simple. I can help guide you to set it up:

First, if you only want people with a game pass to see it then you have to set a code to check if the player does indeed have the game pass.
Second, make a timer, instead of using the text in the Text box as your value do NOT make it that, use a number value and make a code for that number value starting from 700 and to 0. You can code so the game can detect when the time starts and stops etc.
Third, the Gui should be available to ALL players, and only be seen by players who have the game pass, or if you dont want the visible to only players technique you can try duplicating the Gui to players who have the game pass.

game.Players.PlayerAdded:Connect(function(player)
(Check if player has gamepass here)
(then either duplicate the timer gui or make it visible to only those who have met the requirments above)

Timer will/should be it’s own script

while true do
wait()
GuiTextBox.Text = numbervalue.value

These are only for examples to help you, hope they make sense and help out.