Hey guys, I am making a game that generates a grid of tiles, and I was wondering how I would be able to randomly select exactly 20 of those tiles, I’ve tried to use some solutions, but none of them work.
Any help will be appreciated.
local map = workspace.map
local all = map:GetChildren()
local randomTile = all[math.random(20,#all)]
randomTile.BrickColor = BrickColor.new("Black")
local map = workspace:WaitForChild('map')
local all = map:GetChildren()
for i=1,20 do
local randomTile = all[math.random(1,#all)]
randomTile.BrickColor = BrickColor.new('Black')
end