Hello,
I am attempting to make a dropdown list which will return the position of the selected value within the table it is provided. The function creates the dropdown list OK, and this was my rather abysmal attempt at returning the position of the selected option.
Now I know that at some point I need to get my local script to yield, and wait for a selection from the user.
I've hypothetically thought of a few ways of how to tackle this, perhaps the function could return a table with functions attached to each option - and then the local script would have to listen to each using multiple threads?
Regardless, I'm completely stuck and would appreciate any assistance.
Here's my module script:
function module.createDropdownList(element, options)
for i, v in pairs(options) do
local option = Instance.new("TextButton", element)
option.Parent = element
--stuff
option.MouseButton1Click:connect(function()
return i
end)
end
end
And my local script:
main:WaitForChild("create").airline.MouseButton1Click:Connect(function()
selection = module.createDropdownList(main.create.airline, options)
print(selection)
end)
This obviously, prints nil but I thought it would be useful in giving you an idea on how I would love this to work.
Thank you for your time!

1 comment
You can use this api http://wiki.roblox.com/index.php?title=API:Class/RbxGui/CreateDropDownMenu from the RbxGui library