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

"(Name) is not a valid member of Folder" error. How do I fix?

Asked by 7 years ago

So I'm working on a script that gets two players and pairs them up against each other. Right now I'm just working on getting a list of what these 1v1s would be. Here's the script:

values = workspace.Values

function onClicked()

local ranks = values:GetChildren()

i = 1

repeat

local np1 = ranks[math.random(#ranks)]

print(np1.Name)

repeat

np2 = ranks[math.random(#ranks)]

wait()

until np2.Name ~= np1.Name

print(np2.Name)

values[np1.Name]:Destroy()

values[np2.Name]:Destroy()

script.Parent.Parent.ScrollingFrame["Match"..i].Text = (np1.Name.. " vs " ..np2.Name)

i = i + 1

until #ranks < 2
end

script.Parent.MouseButton1Click:connect(onClicked)

At line 27, I always get the same error:

17:34:18.684 - iiEddieSlayer is not a valid member of Folder 17:34:18.685 - Script 'Players.Player1.PlayerGui.ScreenGui.TextButton.Script', Line 27 17:34:18.686 - Stack End

just replace "iiEddieSlayer" with any other name.

Any idea what I messed up on?

Answer this question