Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't the script function as I would like it to? (Script in body)

It says to include code 'snipits', but this is a short script so I will include the whole thing, as well as an explanation of what I am trying to do.

wait(60)
game.StarterGui.Purgetime.TextButton.Script.Disabled = false
game.StarterGui.Waittime.TextButton.Script.Disabled = true
if true then
wait(720)
game.StarterGui.Purgetime.TextButton.Script.Disabled = true
game.StarterGui.Waittime.TextButton.Script.Disabled = false
end

Basically, I am creating a game based off of the movie "The Purge"

What I am trying to do, as you might be able to see is turn the timer script in the GUIs I have off/on at intervals. The Waittime GUI is where the players will wait in the lobby, then when the Waittime GUI is disabled, and the Purgetime GUI is enabled different timers will be active/inactive. My goal is to have an interval where one Script is active while the other is not, wait a certain amount of time, then make the inactive script active, and the active script inactive.

The problem: Nothing is happening when I run the game. Both scripts still run normally, without being activated or deactivated. Thanks!

===========Note: I would also like the script to loop, but I am not sure how..==========

1 answer

✓ Accepted answer

You didn't put what the if statement is checking. Just

if true then

won't work. If you want one of these Disabled properties to be checked, you have to insert them in the if line. Like this:

if game.StarterGui.Purgetime.TextButton.Script.Disabled == true then

Or this:

if game.StarterGui.Waittime.TextButton.Script.Disabled == true then

But beyond that, I didn't understand what you mean, sorry.

2 comments

1

Thank you so much! That fixed it! You're amazing!

0

Thank you, I'm glad I helped.

This discussion is preserved as it was. New answers, comments, and votes are closed.