Hi i am making a zombie wave game and i decided to add a map voting system. I was trying to randomize the map that applies to each of the things you can vote for, I was able to randomize the name but i also made a value in the frame that the name applies to called map. This value is for the main script to call what map was most voted for but the value doesn't change in the map randomizer script.
local map = math.random(3) if map == 1 then script.Parent.Parent.Map.Value = 1 script.Parent.Parent.TextButton.Text = "Grasslands" end if map == 2 then script.Parent.Parent.Map.Value = 2 script.Parent.Parent.TextButton.Text = "The Ditch" end if map == 3 then script.Parent.Parent.Map.Value = 3 script.Parent.Parent.TextButton.Text = "Volcano" end
this is the script and as you can see it chooses between 3 maps and puts the name of the map on the text button you click on to vote for the map, it also should change the map value(it is a number value) if it is chosen but it always stays at 0 help please.
local Maps = {'Grasslands','The Ditch','Volcano'} local Map = Maps[math.random(#Maps)] if Map == 'Grasslands' and not nil then script.Parent.Parent.Map.Value = 1 script.Parent.Parent.TextButton.Text = "Grasslands" elseif Map == 'The Ditch' and not nil then script.Parent.Parent.Map.Value = 2 script.Parent.Parent.TextButton.Text = "The Ditch" elseif Map == 'Volcano' and not nil then script.Parent.Parent.Map.Value = 3 script.Parent.Parent.TextButton.Text = "Volcano" end
If you need to use remote events then do https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events