Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why do all the parts get removed in my script when I want specific ones to stay?

Asked by 4 years ago

Hi! I'm pretty new to scripting and I'm wondering what's wrong with my script and why it removes all the parts instead of all the parts apart from the colour selected. (hope that makes sense)

Here's my script:

01while #game.Players:GetPlayers() < 1 do
02 
03    --      S E I
04    for i = 1, 10, 1 do
05 
06        while #game.Players:GetPlayers() < 1 do
07 
08 
09        local colours = {"Red","Orange", "Yellow", "Green", "Dark Blue", "Light Blue", "Pink", "Purple"}
10        local randomColour = math.random(1,8)
11        local Parts = game.Workspace.GameParts:GetChildren()
12 
13        print("Get ready!")
14 
15        wait(5)
View all 54 lines...
0
I'll check it out Nootian 184 — 4y

1 answer

Log in to vote
0
Answered by
Nootian 184
4 years ago
Edited 4 years ago

Solution The script is all good!, only one mistake, and a suggestion.

See line 30, Transparency spelled wrong

See line 10, doing #Table gets the size of the table, is more efficient

Your problem may be you aren't naming the parts correctly

01while #game.Players:GetPlayers() < 1 do
02 
03    --      S E I
04    for i = 1, 10, 1 do
05 
06        while #game.Players:GetPlayers() < 1 do
07 
08 
09        local colours = {"Red","Orange", "Yellow", "Green", "Dark Blue", "Light Blue", "Pink", "Purple"}
10        local randomColour = math.random(1,#colours)
11        local Parts = game.Workspace.GameParts:GetChildren()
12 
13        print("Get ready!")
14 
15        wait(5)
View all 54 lines...
Ad

Answer this question