#Gui help
1 messages · Page 1 of 1 (latest)
Be specific and include relevant details about the question upfront.
• What are you trying to accomplish?
• If you have code, which part is not working?
• What have you already tried?
• Have you searched the Bedrock Wiki?
i need help
Send code
const form = new ActionFormData()
.title(title)
.body(`§l§o§5Welcome §d${player.nameTag}§5! §5Choose a Option Below!`)
.button(`§3Warps\n§7[ Click to View ]`, "texture/items/map_locked")
.button(`§aShop\n§7[ Click to View ]`)
.button(`§bHomes\n§7[ Click to View ]`)
.button(`§5Discord Code\n§7[ Click to View ]`)
.button(`§8tpMenu\n§7[ Click to View ]`, "textures/items/ender_pearl")
.button(`§aMoney Transfer\n§7[ Click to View ]`)
.button(`§6Credits\n§7[ Click to View ]`, "textures/blocks/diamond_block")
.button(`§cExit Menu`)
form.show(player).then(r => {
if (r.selection == 0) Warps(player)
if (r.selection == 1) Shops(player)
if (r.selection == 2) bukaCommand(player)
if (r.selection == 3) DiscordKit(player)
if (r.selection == 4) tpMenu(player)
if (r.selection == 5) moneyTransfer(player)
if (r.selection == 6) Credits(player)
})
}```
this is the main gui
let actionForm = new ActionFormData()
actionForm.title("SHome GUI")
actionForm.body(`What do you want to do?\n§7do "-h help" for more info`)
actionForm.button("§fSet\n§7add/set new home","textures/ui/color_plus")
actionForm.button("§fChange\n§7change/move your home","textures/ui/book_edit_default")
actionForm.button("§fGo\n§7tp to your home","textures/ui/icon_import")
actionForm.button("§fDelete\n§7remove a house","textures/ui/icon_trash")
actionForm.button("§fList\n§7see all your home","textures/ui/creative_icon")
actionForm.button("§fSpawn\n§7set home as spawn poin","textures/items/bed_red")
actionForm.button("§fPos\n§7see xyz of a house","textures/ui/xyz_axis")
actionForm.button("§4Cancel","textures/ui/cancel")
const actionFormResponse = await ForceShow(actionForm,player)
const {
canceled,
selection,
cancelationReason
} = actionFormResponse
if (canceled === true) {
if (cancelationReason == "userBusy") player.sendMessage({
rawtext: [ {
text: chatPrefix+"can't open ui, please close other ui first"
}]
})
return "cancel"
}
const _r = ["add","move","go","remove","list","setspawn","location","cancel"]
return _r[selection]
}```
this is what im trying to export
and it uses a form wrapper what ever that is
do you import it in the main file?
Yes I did
import { ActionFormData, ModalFormData } from "@minecraft/server-ui"
import { getScore, metricNumbers } from "./examples/getScore.js"
import { Warps } from "./examples/warps.js"
import { Shops } from "./examples/ShopSystem/shop_main.js"
import { tpMenu } from "./examples/tpa/tpMenu.js"
import { bukaCommand } from "./examples/homes/index.js"```
all my imports
take away async and see the errors
no need for async
I’m not getting an error
Creator mode enabled?
delete: form.show, and use: .show
Nothing
where do you show the menu here?
there is no .show
The force show
Show ForeShow(actionForm,player)
code
system
} from "@minecraft/server";
import {
ActionFormData,
MessageFormData,
ModalFormData
} from "@minecraft/server-ui";
export async function ForceShow(form, player, timeout = -1) {
const end = system.currentTick + (timeout * 20)
while (end <= system.currentTick) {
const response = await form.show(player)
if (response.cancelationReason !== "userBusy") {
return response
}
}
throw new Error(`Timed out after ${timeout} ticks`)
}```
What menu is not showing up?
Okay look
That menu works
But none of the buttons work
Like nothing is popping up
But when i type -h it works
try use default guis, without variables and async
When I take out async the command stops working to
don't use response-variables, use callback guis
How do I do that