#Why does my default prefix does not show up on my ModalForm

1 messages · Page 1 of 1 (latest)

stuck spoke
#
class Settings {

    Prefix = "!"

    constructor(Settings) {
        if (!Settings) return
        Object.assign(this, Settings)
    }
}

class SettingsObjectivess {

    GetSettingsGetObjective(player) {
        if (!world.scoreboard.getObjective(`Warp_Settings`))
            world.scoreboard.addObjective(`Warp_Settings`, `Data_Stored`)
        return world.scoreboard.getObjective(`Warp_Settings`)
    }


    GetSettingsGetData(player) {
        let Data = []
        for (let participant of this.GetSettingsGetObjective(player).getParticipants()) {
            let data = new Settings(JSON.parse(participant.displayName))
            Data.push(data)
        }
        return Data
    }



}
export const SettingsObjectives = new SettingsObjectivess

    Prefix(player) {
        let Data = SettingsObjectives.GetSettingsGetData(player)
        const form = new ModalFormData()


        form.textField('The Item To Start The Command', 'Example: !', `${Data.Prefix}`)

        form.show(player).then((data) => {
            SettingsObjectives.GetSettingsGetObjective(player).addScore(JSON.stringify(new Settings({ Prefix: data.formValues[0] })), 0)
        })

    }
frozen slateBOT
#
Debug Result

There are 10 errors in this [code](#1211223767292846081 message):

<repl>.js(22,36): Object is possibly 'undefined'.
<repl>.js(34,6): Cannot find name 'Prefix'.
<repl>.js(34,6): Cannot find name 'player'. Did you mean 'Player'?
<repl>.js(34,1): ';' expected.
<repl>.js(35,6): Cannot find name 'player'. Did you mean 'Player'?
<repl>.js(39,6): Property 'Prefix' does not exist on type 'Settings[]'.
<repl>.js(41,6): Cannot find name 'player'. Did you mean 'Player'?
<repl>.js(42,50): Object is possibly 'undefined'.
<repl>.js(42,6): Cannot find name 'player'. Did you mean 'Player'?
<repl>.js(42,15): 'data.formValues' is possibly 'undefined'.
stuck spoke