#gui function help

1 messages · Page 1 of 1 (latest)

fleet reef
#
function DiscordKit(player) {
    let DiscordCode = new ModalFormData()
    DiscordCode.title("§l§9- Codes -§r");
    DiscordCode.textField('§l§dDiscord Join Code§f: §9Guild Code Here\n\n§l§9Enter Discord Code Below', '§fInput Text Here')
    DiscordCode.show(player).then((r) => {
        if (r.formValues[0] == 'CODE HERE') { //Place your code here
            try {
                player.runCommand(`execute at @s[scores={DiscordKit=1..}] as @s run /tellraw @s {"rawtext":[{"text":"§cYou have already claimed your Discord reward"}]}`)
            }
            catch (e) {
                player.runCommandAsync(`scoreboard players set @s Discordkit 0`);
                player.runCommandAsync(`execute at @s[scores={DiscordKit=0}] as @s run /tellraw @a {"rawtext":[{"text":"§l§d"},{"selector":"@s"},{"text":"§5 Has Claimed Their Discord Reward of §a+§2REWARD HERE§f! \n\n§fJoin The Discord§7:\n§9discord.gg§f/§bGuild Code Here"}]}`);
                player.runCommandAsync(`scoreboard players add @s Money 15000`);
                player.runCommandAsync(`scoreboard players set @s[scores={DiscordKit=0}] DiscordKit 1`); //if you want to give the player an item then use a strcuture block and name it "DiscordKit" and also create a objective called "DiscordKit" to prevent it being redeemed multiple times!
            }
        }
    })
}```
fleet reef
#

yo