#Mine Minigame System
4 messages · Page 1 of 1 (latest)
local MinesAmount = tonumber(WHEREVER YOU HAVE THE TEXT BOX YOU ENTER THE MONEY.Text)
It looks like the code you've provided is incomplete, and it's not clear what you're trying to do with the Table variable. In general, a Mine game involves a grid of cells, some of which contain mines. The player must click on cells to reveal what's underneath, avoiding mines. The game ends when the player either clicks on a mine, or when they have revealed all the cells that do not contain mines.
To make a simple Mine game, you could create a two-dimensional array to represent the grid of cells. You would then randomly select a number of cells to contain mines, and use the values in the array to track whether a cell has been revealed, contains a mine, and so on.
Here is some sample code that shows how you might initialize the grid and place mines randomly:
-- Initialize the grid with empty cells
local grid = {}
for i = 1, 25 do
grid[i] = {}
for j = 1, 25 do
grid[i][j] = { revealed = false, hasMine = false }
end
end
-- Place mines randomly
local mines = 10
while mines > 0 do
local x = math.random(1, 25)
local y = math.random(1, 25)
if not grid[x][y].hasMine then
grid[x][y].hasMine = true
mines = mines - 1
end
end