I am trying to make a script that starts the 15 second count down after clicking the first button on the hotbar. I am really confused, I have tried a lot of methods and all of them seem to not work. Could anyone help me with this?
If you know how to do it, please reply in the comments.
"3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!"
You’ve not explained what methods you’ve tried, so it’s going to be difficult to know what to suggest.
Hello there! It would be better to give a little more information about the problem, such as the certain GUI components you are using, scripting/code that you have tried using, and errors that pop up in the Developer Console that you have tried using, and try and follow the topic format that @TomsGames had stated!
However here is some simple code that I made and tested out that displays a simple timer to a textlabel, when you click a GUI button which you can learn and extract information from.
script.Parent.Frame.Button.MouseButton1Click:Connect(function()
for i = 15,1,-1 do --Loop counting down from 15 to 1
script.Parent.Frame.TextTimer.Text = i --Display the number of the loop
wait(1) --Wait 1 second before the next iteration
end
end)
You can utilize the Visible property after the loop has completed, shown in the following:
script.Parent.Frame.Button.MouseButton1Click:Connect(function()
script.Parent.Frame.TextTimer.Visible = true
for i = 15,1,-1 do
script.Parent.Frame.TextTimer.Text = i
wait(1)
end
script.Parent.Frame.TextTimer.Visible = false
end)
script.Parent.Frame.Button.MouseButton1Click:Connect(function()
script.Parent.OBlastReady.Visible = false
script.Parent.Parent.OBlastWait.Visible = true
wait(15)
script.Parent.OBlastReady.Visible = true
script.Parent.OBlastWait.Visible = false
for i = 15,1,-1 do
script.Parent.Frame.TextTimer.Text = i
wait(1)
end
script.Parent.Frame.TextTimer.Visible = false
end)
I am having a problem, at first before the timer I made it so it would change the images of the button. Now it just makes it not visible and does not make it visible, I tried to add it to the same script as the timer when It is clicked.
I have misread your fourth post about making the timer’s visible property set to false before clicking, to set a visible property manually, you would need to select the timer text label, navigate to the properties tab and un-select the Visible property so that it doesn’t show the timer before you click it.
Please give a little more detail about what you wan’t the GUI to do, as the code you provided seems a bit different than what you stated you want it to do, it would be helpful to provide some screenshots of the GUI components that you used in Explorer so that it would help with de-bugging the code. Also the code I provided is just an example of how you would utilize the looping structure of making a simple timer, and that you would need to change some of the code, such as the name of the timer box, the name of the button, where they are located in the GUI etc.
I no longer need help as I have since tried to understand your script, I edited it to the way I wanted it to be so now it works the way intended. What happens is, the timer is not visible until the button is clicked then the timer goes off and the image changes to the recharging image (Decreased saturation image) this leads up to the timer’s visible property being false after the recharging is over. Thank you so much for helping me.