get the list of all players connected in the "Dropdown" of "ModalForm" is that it returns the nickname of the selected players is not the position in the index/list
//ModalForm Example
function openModalForm(player) {
const ModalForm = new ui.ModalFormData()
ModalForm.title('Modal Form')
ModalForm.textField('This is a Textfield', 'This is a Placeholdertext')
ModalForm.dropdown('This is a Dropdown', ['Option 1', 'Option 2', 'Option 3', 'Option 4', 'Option 5'], 0)
ModalForm.slider('This is a Slider', 0, 100, 1, 50)
ModalForm.toggle('This is a Toggle', false)
ModalForm.show(player).then(response => {
if (response.canceled) {
openMain(player)
return
}
let [textField, dropdown, slider, toggle] = response.formValues
player.runCommandAsync(`tellraw @s {"rawtext":[{"text":"Textfiel: ${textField}\nDropdown: ${dropdown}\nSlider: ${slider}\nToggle: ${toggle}\n"}]}`)
})
}