I’m making a dropper game that randomly chooses game modes. It is a function that chooses the game mode through math.random() on an array. My problem is that when the function is called more than once, it doesn’t update.
When the function is called more than once, the print() prints the random game mode but the GamemodeText’s text still stays the same as the first math.random()'s value.
Example:
First time function is called:
math.random() chooses “value”
print() prints “value”
GamemodeText.Text is changed to “Gamemode: value”
Second time function is called:
math.random() chooses “value2”
print() prints “value2”
BUT GamemodeText.Text is still the same, the value still being “value”
So, I think it might be better if you select your random chosen tower, each time WITHIN the function, and pass through the Towers Array, to ensure that you get a different value each time. So, I would do…
local function NewTower(TowerTypes)
local ChosenTower = TowerTypes[math.random(1,#TowerTypes)]
return ChosenTower
end
print("GameMode: " NewTower(TowerTypes))
So the StringValue changes to the game mode, but it seems that the problem is that if I do ChosenTower.Value it still returns the very first value it had.