What do you want to achieve? Keep it simple and clear!
A Minesweeper game on gui, basically a big frame with tiles and each one could be a bomb and ect (Im sure you know what minesweeper is)
What is the issue? Include screenshots / videos if possible!
I have no idea how to randomize these gui “tiles”
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Lots of tutorials, that told me nothing.
I just need some advice on, how to do it, or at least something that will point me in the right direction.
Randomized table values, randomized button values, there’s lots of ways really, simplest would be setting a value to each tile and loop through all those values and randomize them from 1 to 4
Maybe have a frame with a gridlayout and have nested for loops in a script for each axis then clone a template block and place it at a position based on the X index and Y index, then simply do this:
Write a function to randomly generate mine positions on the grid. You can use the math.random function to generate random numbers within a range. Assign mines to specific cells by changing their states or properties.
Maybe try:
-- Generate random mine positions (make sure you replaced everything here you need to replace
local function generateMines()
local mines = {}
for i = 1, totalMines do
local x = math.random(1, gridSizeX)
local y = math.random(1, gridSizeY)
mines[#mines + 1] = {x = x, y = y}
end
return mines
end
I have made a 10 by 10 grid of text buttons, And they are in a folder, and that folder is in a Frame. Do I just insert a local script into that frame and put your script with all the correct measurements inside the script, or is there more than that.