SelectMap()
You haven't defined Map1
, Map2
, or Map3
.
That means your definition of Maps
is equivalent to
This will also cause #Maps
to be 0
.
Use strings for Maps
:
1 | Maps = { "Map1" , "Map2" , "Map3" } |
In addition, even if the above was fixed, your code still wouldn't work.
Your checks are comparing a
and "Map1"
-- but a
is just a random number, which isn't ever one of the map names.
You should be looking at Maps[a]
, that is, the a
th thing in Maps
.
All this simplifies your work in SelectMap
: good code should not care about how many / which are the maps that are in your list -- the information it needs should be good enough by just inspecting Maps
:
2 | a = math.random( 1 ,#Maps) |
4 | b = game.Lighting [ Maps [ a ] ] :Clone() |
6 | b:MoveTo(Vector 3. new( 0 , 0 , 0 )) |
Lifter()
Size
is a Vector3
, not a CFrame
.
It's much cleaner and easier to understand
1 | d.Size = Vector 3. new( 10 , i, 10 ) |
over
1 | d.Size = d.Size + Vector 3. new( 0 , 1 , 0 ) |
(In your original code, you used x
, y
, and z
but never defined them)
Both of these comments go for Position too -- except that you should be using the CFrame
property, not Position
.
There isn't a better way to wait in minutes, but it might be cleaner to say
because then it's clearer where the number 600
came from (it's obviously 10 * 60seconds = 10 minutes)