Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

y u no work ?

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

✓ Accepted answer

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!

2 comments

0

thank you so much

0

No problem!

This discussion is preserved as it was. New answers, comments, and votes are closed.