I have an issue with "while true do" in one of my scripts

Hello there scripters, programmers, developers!

I’m trying to make up a game related to the 2017/2018 trend of “The floor is lava!”, but more original, this is one of the main scripts that will make the game work, this needs to edit the properties of the GUIs and change a lot of things in the map with waits. I wanted to start the code using while true do ofc.

Please explain what I’m doing wrong, when I press enter an “end” does not appear and I think that it should do.

--[[ Just Col4ter4l should have access to this script as if any other developer touches it, it
could break Team Create and Col4ter4l would have to reset Team Create what means resetting every
script and making it blank or as the last update/save. If you get in this script by mistake, please
DM Col4ter4l the entire script copying everything so when he resets Team Create something bad
doesn't occur, thank you. ]]--

-----------------------------------| BigEventUpdateWait = 230, HistoricEventUpdateWait = 680.
-------------Variables-------------| ClassicWait = 25, MediumWait = 60, LargeWait = 120.
-----------------------------------| SmallWait = 10, UltraSmallWait = 0.3, NormalWait = 17.
UltraSmallWait = 0.3
SmallWait = 10
NormalWait = 17
ClassicWait = 25
MediumWait = 60
LargeWait = 120
BigEventUpdateWait = 230
HistoricEventUpdateWait = 680
LavaSignText = game.StarterGui.LavaScreenGUI.Frame.TextLabel.Text

--------------------------------------|
-----------------Code-----------------|
--------------------------------------|
while true do

More information here.

Note: I’m very new to scripting so sorry if I’m doing something bad and tell me how to improve and maybe something else? Thank you.

You need an end to a loop. If you’re new, please read the DevHub loops article as that sums up everything.

When using while loops, make sure you have a wait(x) in there, or just wait(). Otherwise, it’ll crash your game and make it unplayable!

while true do

    --code
    wait()

end --you need this to close off your loop

--or 

while wait() do

    --code (since you have wait() already, you don't need it here)

end
1 Like

you must to write first while true do and then put your code to work correct . Else it will not work , hope you’ll understand right :slight_smile: