How would you combine these functions? [closed]
I recently created a script, and I need help combining the functions so they don't spam over, and over. I'd also like to know (If that's not the problem) What the error is to my script.
Here it is. On line 8 starts the functions:
001 | Maps = { "Wobbly Bridge" , "Tower Of Magic" } |
003 | HowLongMessageLasts = 5 |
004 | HowLongVotingPeriodLasts = 15 |
005 | MessageToBeStated = "Seconds Left: " |
009 | m = Instance.new( "Message" , Workspace) |
010 | m.Text = "Map Selected: " .. MAP .. "!" |
015 | m = Instance.new( "Message" , Workspace) |
016 | m.Text = "" .. MAP .. "____ was picked!" |
021 | m = Instance.new( "Message" , Workspace) |
022 | m.Text = "You will be playing on the " .. MAP .. " map" |
027 | m = Instance.new( "Message" , Workspace) |
032 | Players = game.Players:GetPlayers() |
033 | Ls = game.Lighting:GetChildren() |
034 | _G.MAPA = { "Wobbly Bridge" } |
035 | _G.MAPB = { "Tower Of Magic" } |
052 | _G.NothingCurrently = { } |
053 | Lasting = HowLongVotingPeriodLasts |
055 | HowLongVotingPeriodLasts = Lasting |
057 | for o = 1 ,#Players do |
058 | gui = game.Lighting.Vote:Clone() |
059 | gui.Parent = Players [ o ] .PlayerGui |
062 | a = HowLongVotingPeriodLasts |
064 | m = Instance.new( "Message" , Workspace) |
065 | m.Text = "Voting Time: " |
070 | for i = 1 ,#Players do |
071 | val = Players [ i ] .Map.Value |
072 | table.insert(_G [ val ] , val) |
074 | mapn = math.max(#_G.MAPA, #_G.MAPB, #_G.MAPC, #_G.MAPD, #_G.MAPE, #_G.MAPF, #_G.MAPG, #_G.MAPH, #_G.MAPI, #_G.MAPJ, #_G.MAPK, #_G.MAPL, #_G.MAPM, #_G.MAPN, #_G.MAPO, #_G.MAPP, #_G.MAPQ, #_G.MAPR) |
075 | if #_G.MAPA = = mapn then |
077 | if Ls [ u ] :FindFirstChild( "A" ) ~ = nil then |
083 | Mapp.Parent = Workspace |
087 | elseif Option = = 2 then |
089 | elseif Option = = 3 then |
091 | elseif Option = = 4 then |
094 | print ( "Invalid option" ) |
096 | for y = 1 ,#Players do |
098 | Players [ y ] .TeamColor = BrickColor.new( "Really red" ) |
100 | elseif COLOR = = 2 then |
101 | Players [ y ] .TeamColor = BrickColor.new( "Really blue" ) |