Player = game.Players.LocalPlayer
LS = Player:WaitForChild("leaderstats")
Stage = LS:WaitForChild("Level")
Txt = script.Parent:WaitForChild("Level")
StageNames = {
[2] = "Stage 2 - Don't get catched by the aliens!",
[3] = "Stage 3 - Don't touch the toxic water.",
[4] = "Stage 4 - Escape the vent!",
[5] = "Stage 5 - BLADES!!",
[6] = "Stage 6 - Don't Touch the drilling rigs!",
[7] = "Stage 7 - Avoid the lasers!",
[8] = "Stage 8 - Do not cross!",
[9] = "Stage 9 - Jump on UFOs!",
[10] = "Stage 10 - Being Eaten.",
[11] = "Stage 11 - The stomach.",
[12] = "Stage 12 - Jump on these things..!",
[13] = "Stage 13 - Choose the right wall.",
[14] = "Stage 14 - This is the only way out...",
[15] = "Stage 15 - Avoid the sand!",
[16] = "Stage 16 - Do not touch the cars!!",
[17] = "Stage 17 - Almost there.."
[18] = "Stage 18 - Do not touch the cactus!"
[19] = "Stage 19 - This rusty metal can kill you"
[20] = "Stage 20 - Rainbow jumps."
[21] = "Stage 21 - WE DID IT!"
}
function DoStage()
for i = 1, string.len(StageNames[Stage.Value]) do
Txt.Text = string.sub(StageNames[Stage.Value], 1, i)
wait()
end
wait(4)
for i = string.len(StageNames[Stage.Value]), 0, -1 do
Txt.Text = string.sub(StageNames[Stage.Value], 1, i)
wait()
end
end
Stage.Changed:connect(function()
if StageNames[Stage.Value] then
script:WaitForChild("CheckPoint"):Play()
DoStage()
end
end)
DoStage()
DoStage()
COMMUNITY QUESTION
How to fix this error? ScreenGui.Main:23: '}' expected (to close '{' at line 6) near '['
2 answers
You didn't finish putting in Commas, Try this as the StageNames
StageNames = {
[2] = "Stage 2 - Don't get catched by the aliens!",
[3] = "Stage 3 - Don't touch the toxic water.",
[4] = "Stage 4 - Escape the vent!",
[5] = "Stage 5 - BLADES!!",
[6] = "Stage 6 - Don't Touch the drilling rigs!",
[7] = "Stage 7 - Avoid the lasers!",
[8] = "Stage 8 - Do not cross!",
[9] = "Stage 9 - Jump on UFOs!",
[10] = "Stage 10 - Being Eaten.",
[11] = "Stage 11 - The stomach.",
[12] = "Stage 12 - Jump on these things..!",
[13] = "Stage 13 - Choose the right wall.",
[14] = "Stage 14 - This is the only way out...",
[15] = "Stage 15 - Avoid the sand!",
[16] = "Stage 16 - Do not touch the cars!!",
[17] = "Stage 17 - Almost there..",
[18] = "Stage 18 - Do not touch the cactus!" ,
[19] = "Stage 19 - This rusty metal can kill you",
[20] = "Stage 20 - Rainbow jumps.",
[21] = "Stage 21 - WE DID IT!",
}
You missed some commas:
StageNames = {
[2] = "Stage 2 - Don't get catched by the aliens!",
[3] = "Stage 3 - Don't touch the toxic water.",
[4] = "Stage 4 - Escape the vent!",
[5] = "Stage 5 - BLADES!!",
[6] = "Stage 6 - Don't Touch the drilling rigs!",
[7] = "Stage 7 - Avoid the lasers!",
[8] = "Stage 8 - Do not cross!",
[9] = "Stage 9 - Jump on UFOs!",
[10] = "Stage 10 - Being Eaten.",
[11] = "Stage 11 - The stomach.",
[12] = "Stage 12 - Jump on these things..!",
[13] = "Stage 13 - Choose the right wall.",
[14] = "Stage 14 - This is the only way out...",
[15] = "Stage 15 - Avoid the sand!",
[16] = "Stage 16 - Do not touch the cars!!",
[17] = "Stage 17 - Almost there..", -- here
[18] = "Stage 18 - Do not touch the cactus!", -- here
[19] = "Stage 19 - This rusty metal can kill you", --here
[20] = "Stage 20 - Rainbow jumps.", -- here
[21] = "Stage 21 - WE DID IT!"
}
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
["2] ["3"] not [2], [3] it has to be a string