Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

y u no work ?

Asked by 9 years ago
local player = game.Players.LocalPlayer

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 v[1].Value == "" then
    v[1].Value = player.Name
    elseif v[2].Value == "" then
    v[2].Value = player.Name
    elseif v[3].Value == "" then
    v[3].Value = player.Name
    elseif v[4].Value == "" then
    v[4].Value = player.Name
    elseif v[5].Value == "" then
    v[5].Value = player.Name
    end
    end
    end
end)

it breaks on the 8th line saying 1 is not a valid member of StringValue please help

1 answer

Log in to vote
1
Answered by 9 years ago

The "foreach" loop (even though it isn't really called that in Lua) sorts through all of the data in a table for you. Apparently, you are attempting to find the index of 1 on line 8. However, v is actually equal to the StringValue, not the table itself. Therefore, the proper appearance of line 8 is this:

if ranking[1].Value=="" then

Unfortunately, I was not able to find a proper citation for you on the wiki. Sorry :/ Anyway, I hope this helped!

0
thank you so much joeyortiger 30 — 9y
0
No problem! ChipioIndustries 454 — 9y
Ad

Answer this question