I am making a game with different themes which are randomly selected. It works fine but sometimes it chooses the same theme it chose before. I want it to not choose a theme which was chosen last round. I have tried doing it but couldn’t succeed.
Can anyone help out how to make it work or is there a better way to do this?
Code:
if (not _G.Themes) then -- I am doing this because this script sometimes get disabled and then enabled when round ends.
_G.Themes = game.ServerStorage.Themes:GetChildren()
end
local themeNum = 1 -- Theme num is 1 for testing
themeChosen = _G.Themes[themeNum]
print(lastTheme.Value)
table.insert(_G.Themes,lastThemeIndex.Value,lastTheme.Value)
table.remove(_G.Themes,themeNum)
lastThemeIndex.Value = themeNum
lastTheme.Value = themeChosen
print(lastTheme.Value)
Thanks!