Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a clock count down?

Asked by 10 years ago
01AwayS = script.Parent.workspase
02Clock = script.Parent.workspace
03HomeS = script.Parent.workspace
04LTeam = script.Parent.workspace
05Quarter = script.Parent.workspace
06RTeam = script.Parent.workspace
07 
08script.Parent.workspace.Function("Clock")
09script.Parent.workspace = function "IsRunning"
10if true then
11    script.Parent.function = "IsRunning" than math. 5:oo subtract (1)
12 
13end

Is this right?

3 answers

Log in to vote
1
Answered by
duckyo01 120
10 years ago

You may need to do a loop like make 5:00 to seconds.

0
Dang, that will take forever... devSpeed 0 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

No, this is NOT correct, as this is NOT a working code! As your code is, it does not work. Let me point out the mistakes:

1. Lines 1-6 script.Parent.workspace? Is there an Instance within the scripts Parent named Workspace? If not, that's one problem, and not necessary to create so many identifiers that are doing the same purpose; It just uses up code-space.

2. Lines 8-9 script.Parent.workspace = Value? You are making those into Identifiers, and also attempting to make them functions, when you are doing it incorrectly.

3. Line 10 if true then? That will always run, because 'true' is, well, true, but, however, an if statement allows a block of code to run if it's Condition is equal/met to it's Argument, or if it equals true, you may want to rethink that part.

4. Line 11 script.Parent.function = Value? Your once again trying to create a function that will not work.

As your code is, it will not work. This is fixable however, but, I am not going to create a full script for you, just an example;

1. This will require a for loop

2. Also will require the wait method Now, let's rewrite your code;

1for i = 5*60, 0, -1 do --Here is our four loop; This will begin it's time of 5*60, 5 minutes, or 250 seconds, will count down from -1, or down from 1, until identifier 'i' reaches 0; This will loop until 'i' reaches 0
2print("Countdown:",i) --This will print into the Output; For each time 'i' goes down from '250', it will print the number into the Output; 'Countdown: 250', 'Countdown: 249', 'Countdown: 248', ect
3wait(1) --This will wait 1 second before running the code again
4end --This ends the code block for the 'for' loop

Hope this helped!

Log in to vote
0
Answered by 10 years ago

(I will use a gui for this one.) Put the gui in this way:

1game
2    StarterGui
3            ScreenGui
4                    Frame
5                        TextLabel
6                                Sound --If you want!
7                                Script 

Script:

01countdown = 0 --Put the time you want.
02 
03while true do
04    script.Parent.Text = countdown
05    countdown = countdown - 1
06    wait(1) --This will disable lag.
07end
08 
09if countdown == 1
10    then script.Parent.Text = ("Times up!")
11    script.Parent.Sound:Play() --If you do not have the sound remove this line or else this code will not work!
12    script.Parent.Parent.Parent:remove() -- remove this line if you don't want it here.
13end

Answer this question