Making a minigame type game, better way to setup the script?
Asked by
6 years ago Edited 6 years ago
What's the better way to set up the types of minigames? I have a table in my Main script chosing the game mode.
1 | gameModes = { "Falling Bricks" , "Color Plates" } |
Now I could either script all the gamemodes into the main script
1 | chosenGamemode = math.random( 1 ,#gameModes) |
2 | if gameModes [ chosenGamemode ] = = "Falling Bricks" then |
4 | elseif gameModes [ chosenGamemode ] = = "Color Plates" then |
Like that, or make a separate script for each gamemode and run them like this,
1 | chosenGamemode = math.random( 1 ,#gameModes) |
2 | gamemodeClone = game.ReplicatedStorage.games [ gameModes [ chosenGamemode ] ] :Clone() |
3 | gamemodeClone = game.ServerScriptStorage |
And do it that way?