Math.random Help Please!

Hey yall!

i really need help on, there 3 buttons on the map and random button spawn in positions and if no one clicked it will change to other button and if someone clicked it will change to other button

sorry for bad English if you don’t understand i can explain it to you

What do you mean by, “random transparent”

hey I edited it to make more understand, sorry!

Ok, so like a set of buttons and when you click one or one is left out to long, it changes in to a random button from the set?

local setOfButtons = {
   ["button1"] = {},
   ["button2"] = {},
   ["button3"] = {},
}

Kinda like that, but not a variable but the children of something?

Yes! that what i want! :DDDDDDDDDDDDDDDD

Ok, you could maybe do something like

function GetRandomButton()
     local pathToSet
     local randomButton = pathToSet:GetChildren()[math.random(1,#pathToSet:GetChildren)]
end
1 Like

Sorry, I did a mistake. It should work now.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.