Still have questions? Join our Discord server and get real time help.
0

# Why wont my Timer go visible. It wont even change the text???(GUI)

I am currently developing a game and for some reason my timer gui wont show up and count down here is my script...

COT = game.ReplicatedStorage.CorruptedTimer.Value
TCO = script.Parent
gameie = game.ReplicatedStorage.Game.Value
local mytable = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}

if gameie == 5 then
TCO.Visible = true

for i, v in pairs(mytable) do
TCO.Text = COT
COT = COT -1
end
TCO.Visible = false
end


any other methods of triggering an event that makes a timer run????

0

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.

local yourGUI =  script.Parent --Set your ScreenGUI or Frame.
local guiText = yourGUI.Text
gameie = game.ReplicatedStorage.Game.Value
local timer = 20

if gameie == 5 then
yourGUI.Enabled = true --Do Visible or change the transparency if it isnt a ScreenGUI.
while true do
wait(1)
timer   -= 1
if timer == 0 then
break
yourGUI.Enabled = false
end
end
end


I really hope this works and helped! At least you have an idea of how to do it.

0
Make the variables local! Don't do for do loop. LetalNightmare 79 — 2mo
0
what does break mean Lamborghinihurican0 2 — 2mo
0
You use break to stop a while true do. LetalNightmare 79 — 2mo
0
ok thank u Lamborghinihurican0 2 — 2mo
0
it says on line 13 that it expected end on line 11 to end then??? how do i fix?? Lamborghinihurican0 2 — 2mo
0
Add 1 more end, to close that if statement. LetalNightmare 79 — 2mo
0
Or, you can delete every end, and press enter after each function/event. That works 100% LetalNightmare 79 — 2mo
0
ok Lamborghinihurican0 2 — 2mo
0
still didnt work Lamborghinihurican0 2 — 2mo
0
What is gameie, what is COT, what is TCO? Because i know what's the problem here. LetalNightmare 79 — 2mo
0
it is an int value Lamborghinihurican0 2 — 2mo
0
they all are int values Lamborghinihurican0 2 — 2mo
0
and i am using a script not a local script is that a problem?? Lamborghinihurican0 2 — 2mo
0
Yes, do it LocalScript. And every variable always local. Watch a basics video of Lua, it will help. LetalNightmare 79 — 2mo
0
I_Nev 200
2 months ago

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

COT = game.ReplicatedStorage.CorruptedTimer.Value
TCO = script.Parent
gameie = game.ReplicatedStorage.Game

gameie.Changed:Conect(function()
if gameie.Value == 5 then
TCO.Visible = true
for i = 20,1,-1 do
TCO.Text = COT
COT = COT -1
wait(1)
end
TCO.Visible = false
end
end)

0
Edited 2 months ago

use a if statement

COT = game.ReplicatedStorage.CorruptedTimer.Value
TCO = script.Parent
gameie = game.ReplicatedStorage.Game.Value
local mytable = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}

if gameie == 5 then
TCO.Visible = true

for i, v in pairs(mytable) do
TCO.Text = COT
COT = COT -1
if COT == 0 then
TCO.Visible = false
end

end