of     2   
chevron_rightchevron_rightchevron_right

crazyblox
#63234604Tuesday, February 21, 2012 7:49 PM GMT

If there is a single vote for one, and a single vote for six, then it will always choose one, because it wouldnt even think of six. What i'm asking for is to make this current part of the voting system NOT Biased. Thanks. one = script.Parent.Votes.One.Value two = script.Parent.Votes.Two.Value three = script.Parent.Votes.Three.Value four = script.Parent.Votes.Four.Value five = script.Parent.Votes.Five.Value six = script.Parent.Votes.Six.Value if math.max(one,two,three,four,five,six)==one then marp = 1 elseif math.max(one,two,three,four,five,six)==two then marp = 2 elseif math.max(one,two,three,four,five,six)==three then marp = 3 elseif math.max(one,two,three,four,five,six)==four then marp = 4 elseif math.max(one,two,three,four,five,six)==five then marp = 5 elseif math.max(one,two,three,four,five,six)==six then marp = 6 elseif math.max(one,two,three,four,five,six)==0 then marp = math.random(1,6) end
crazyblox
#63238088Tuesday, February 21, 2012 9:07 PM GMT

Bump
mammed22
#63238260Tuesday, February 21, 2012 9:10 PM GMT

OMG CRAZYBLOX FIRST POST
mammed22
#63238305Tuesday, February 21, 2012 9:10 PM GMT

Oh and I dont know how to script much sooooo....
crazyblox
#63238771Tuesday, February 21, 2012 9:18 PM GMT

Bump
TLua
#63239547Tuesday, February 21, 2012 9:32 PM GMT

So um, check if both the numbers are the same?
noobkid
#63240027Tuesday, February 21, 2012 9:41 PM GMT

Uglyhax... Just use; Marp = math.max(..)
crazyblox
#63241063Tuesday, February 21, 2012 9:57 PM GMT

Noobkid, you read my thread wrong. I want it to return the number/map with the most votes, not the value of the map/number with the most votes.
iFordMC
#63241345Tuesday, February 21, 2012 10:01 PM GMT

I'm not sure but try putting this in a table like so. one = script.Parent.Votes.One.Value two = script.Parent.Votes.Two.Value three = script.Parent.Votes.Three.Value four = script.Parent.Votes.Four.Value five = script.Parent.Votes.Five.Value six = script.Parent.Votes.Six.Value Vote1 = { if math.max(one,two,three,four,five,six)==one then marp = 1 } if math.max(Vote1, Vote2)==Vote1 then etc. i have never heard of math.max but hope this helped =P
iFordMC
#63241420Tuesday, February 21, 2012 10:02 PM GMT

Oh I meant put his after the end ok? Hope I helped =P
iFordMC
#63241584Tuesday, February 21, 2012 10:06 PM GMT

You know what, Try this. one = script.Parent.Votes.One.Value two = script.Parent.Votes.Two.Value three = script.Parent.Votes.Three.Value four = script.Parent.Votes.Four.Value five = script.Parent.Votes.Five.Value six = script.Parent.Votes.Six.Value if math.max(one,two,three,four,five,six)==one then marp = 1 elseif math.max(one,two,three,four,five,six)==two then marp = 2 elseif math.max(one,two,three,four,five,six)==three then marp = 3 elseif math.max(one,two,three,four,five,six)==four then marp = 4 elseif math.max(one,two,three,four,five,six)==five then marp = 5 elseif math.max(one,two,three,four,five,six)==six then marp = 6 elseif math.max(one,two,three,four,five,six)==0 then marp = math.random(1,6) end while wait(1) do if marp == 1 then -- Code here. elseif marp == 2 then --Code here end I really have no idea, Even as I am a rather strong Lua coder...
iFordMC
#63241633Tuesday, February 21, 2012 10:07 PM GMT

Forgot the extra end =P end end
epicfail22
#63241862Tuesday, February 21, 2012 10:10 PM GMT

Wouldn't just using one math.max() work because it would return the highest voted map?
iFordMC
#63243270Tuesday, February 21, 2012 10:35 PM GMT

No he wants not to print it, But to see if it is... I don't know what I'm saying...
epicfail22
#63243787Tuesday, February 21, 2012 10:44 PM GMT

@OP; Just do marp = math.max(one,two,three,four,five,six) That will return a number value anyway, so 'marp' will be set as a number.
crazyblox
#63443083Saturday, February 25, 2012 11:13 PM GMT

I honestly dont know how Tables work. Sorry! and for the marp = math.max() thing, it would return what the highest votes of most chosen value, so if 3 people voted for map 4, it would load up map 3, because it reads the value, not the mapnumber. I feel like i dont even know what im doing anymore xD one = script.Parent.Votes.One.Value two = script.Parent.Votes.Two.Value three = script.Parent.Votes.Three.Value four = script.Parent.Votes.Four.Value five = script.Parent.Votes.Five.Value six = script.Parent.Votes.Six.Value seven = script.Parent.Votes.Seven.Value if math.max(one,two,three,four,five,six,seven)==one then marp = 1 elseif math.max(one,two,three,four,five,six,seven)==two then marp = 2 elseif math.max(one,two,three,four,five,six,seven)==three then marp = 3 elseif math.max(one,two,three,four,five,six,seven)==four then marp = 4 elseif math.max(one,two,three,four,five,six,seven)==five then marp = 5 elseif math.max(one,two,three,four,five,six,seven)==six then marp = 6 elseif math.max(one,two,three,four,five,six,seven)==seven then marp = 7 elseif math.max(one,two,three,four,five,six,seven)==0 then marp = math.random(1,7) end print(marp) game.Lighting[marp]:Clone().Parent = game.Workspace game.Workspace[marp].Name = "Map"
crazyblox
#63443807Saturday, February 25, 2012 11:28 PM GMT

Bump. MALLEO
crazyblox
#63446238Sunday, February 26, 2012 12:12 AM GMT

Bump.
NewFissy
#63446859Sunday, February 26, 2012 12:23 AM GMT

Hi crazyblox. Try this script: Maps = {script.Parent.Votes.One.Value,script.Parent.Votes.Two.Value,script.Parent.Votes.Three.Value,script.Parent.Votes.Four.Value,script.Parent.Votes.Five.Value,script.Parent.Votes.Six.Value} -- Map Votes function ReturnHighestVotes() MaxVotes=math.max(one,two,three,four,five,six) MaxVotesMaps = {} for i = 1, #Maps do if Maps[i] == MaxVotes then table.insert(MaxVotesMaps,i) end end if #MaxVotesMaps == 1 then return MaxVotesMaps[1] else return MaxVotesMaps[math.random(1,#MaxVotesMaps)] end end MapNumbWithHighestVotes = ReturnHighestVotes() print(MapNumbWithHighestVotes) game.Lighting[MapNumbWithHighestVotes]:Clone().Parent = game.Workspace -- Example Map chosen: game.Lighting.1 game.Workspace[MapNumbWithHighestVotes].Name = "Map"
vargy3454
#63446985Sunday, February 26, 2012 12:25 AM GMT

crazyblox
#63449927Sunday, February 26, 2012 1:19 AM GMT

Hi Fissy, i've used your coding and it works a charm so far in solo! Im going to upload it now. Thanks!
crazyblox
#63453784Sunday, February 26, 2012 2:28 AM GMT

Uh oh! theres something horribly wrong with that code! if map one has 2 votes, and map seven has 4 votes, IT CAN CHOOSE MAP ONE! I want it so if Map one has 4 votes and map seven has 4 votes they can be chosen between eachother, not map one being chosen when it has less votes than map seven! It doesnt have to be map one or seven, this is just an example, HELP!
HatHelper
Top 25 Poster
#63454022Sunday, February 26, 2012 2:32 AM GMT

So if two maps have the same amount of votes, you want it to choose fairly between the two(or more)?
crazyblox
#63454060Sunday, February 26, 2012 2:33 AM GMT

Yes, if thats possible.
HatHelper
Top 25 Poster
#63454195Sunday, February 26, 2012 2:35 AM GMT

This is not the most efficient script, but here: maps = {1,2,3,4,5,6} votes = {1,0,2,2,1,1} maps={1},vot=0 for i=1, #votes do if votes[i] > vot then maps = {i} vot = votes[i] elseif votes[i] == vot then table.insert(maps, i) end end mapselected = maps[math.random(1, #maps)] not sure if this is waht you want untested.

    of     2   
chevron_rightchevron_rightchevron_right