local player = script.Parent.Parent.Parent.Parent.Parent ranking = {workspace.Values.Line.First, workspace.Values.Line.Second, workspace.Values.Line.Third, workspace.Values.Line.Fourth, workspace.Values.Line.Fifth} script.Parent.MouseButton1Down:connect(function(p) for i,v in pairs (ranking) do if v.Value ~= player.Name then if ranking[1].Value=="" then ranking[1].Value = player.Name elseif ranking[2].Value=="" then ranking[2].Value = player.Name elseif ranking[3].Value=="" then ranking[3].Value = player.Name elseif ranking[4].Value=="" then ranking[4].Value = player.Name elseif ranking[5].Value=="" then ranking[5].Value = player.Name end end end end)
so I have a GUI that is sort of like a line. You have to click a button and you will be placed in the next available spot. This script is suppose to find all the Values and see if it's ~= your name so that you can't line up twice. That works. This script is then suppose to find out if ranking[1] is empty and if it is it will put your name on it. If it isn't, its suppose to put you on ranking[2] and if ranking[2] is not empty, it is suppose to put you on ranking[3] and if ranking 3 is not empty its suppose to put you on ranking[4] and so on.
This script WORKS but the problem is that it will fill up every single ranking with your name, it's like it ignores the elseifs and simply just fills up all the values with your name, can someone help me fix this please