Parts staying when should have been made transparent?
Hey, basically, when a colour is selected, all the other colours are meant to disappear, but for some reason, this doesn't happen a few rounds in.
For example, the colour is yellow, but it leaves blue parts. I'll leave the code below.
01 | while #game.Players:GetPlayers() < 1 do |
06 | local colours = { "Red" , "Orange" , "Yellow" , "Green" , "Dark Blue" , "Light Blue" , "Pink" , "Purple" , "White" } |
07 | local randomColour = math.random( 1 ,#colours) |
08 | local Parts = game.Workspace.GameParts:GetChildren() |
14 | print ( "Selecting safe part..." ) |
18 | print (colours [ randomColour ] ) |
22 | local Parts = game.Workspace.GameParts.unsafeParts:GetChildren() |
24 | for i, v in pairs (Parts) do |
25 | if v:IsA( "Part" ) and v.Name = = colours [ randomColour ] then |
26 | v.Parent = game.Workspace.GameParts.safeParts |
28 | elseif v:IsA( "Part" ) and v.Name ~ = randomColour then |
29 | print ( "Removing parts." ) |
37 | print ( "Parts removed." ) |
42 | for i,v in pairs (workspace.GameParts.unsafeParts:GetChildren()) do |
45 | v.Parent = game.Workspace.GameParts.unsafeParts |
48 | print ( "Game Over! A new round will be starting soon." ) |