I am currently developing a game and for some reason my timer gui wont show up and count down here is my script...
01 | COT = game.ReplicatedStorage.CorruptedTimer.Value |
02 | TCO = script.Parent |
03 | gameie = game.ReplicatedStorage.Game.Value |
04 | local mytable = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 } |
05 |
06 | if gameie = = 5 then |
07 | TCO.Visible = true |
08 |
09 | for i, v in pairs (mytable) do |
10 | TCO.Text = COT |
11 | COT = COT - 1 |
12 | end |
13 | TCO.Visible = false |
14 | end |
any other methods of triggering an event that makes a timer run????
Just make a variable, you don't need a table. Do a variable and a while true do. And also you need to change the Text of the GUI.
01 | local yourGUI = script.Parent --Set your ScreenGUI or Frame. |
02 | local guiText = yourGUI.Text |
03 | gameie = game.ReplicatedStorage.Game.Value |
04 | local timer = 20 |
05 |
06 | if gameie = = 5 then |
07 | yourGUI.Enabled = true --Do Visible or change the transparency if it isnt a ScreenGUI. |
08 | while true do |
09 | wait( 1 ) |
10 | timer - = 1 |
11 | if timer = = 0 then |
12 | break |
13 | yourGUI.Enabled = false |
14 | end |
15 | end |
16 | end |
I really hope this works and helped! At least you have an idea of how to do it.
Try this, when the game value in replicated changes it will update the function, you was only running the if statement once, and after that one time it would return false and not go ahead
01 | COT = game.ReplicatedStorage.CorruptedTimer.Value |
02 | TCO = script.Parent |
03 | gameie = game.ReplicatedStorage.Game |
04 |
05 | gameie.Changed:Conect( function () |
06 | if gameie.Value = = 5 then |
07 | TCO.Visible = true |
08 | for i = 20 , 1 ,- 1 do |
09 | TCO.Text = COT |
10 | COT = COT - 1 |
11 | wait( 1 ) |
12 | end |
13 | TCO.Visible = false |
14 | end |
15 | end ) |
use a if statement
01 | COT = game.ReplicatedStorage.CorruptedTimer.Value |
02 | TCO = script.Parent |
03 | gameie = game.ReplicatedStorage.Game.Value |
04 | local mytable = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 } |
05 |
06 | if gameie = = 5 then |
07 | TCO.Visible = true |
08 |
09 | for i, v in pairs (mytable) do |
10 | TCO.Text = COT |
11 | COT = COT - 1 |
12 | if COT = = 0 then |
13 | TCO.Visible = false |
14 | end |
15 |
16 | end |