#RPG Shop.....
1 messages · Page 1 of 1 (latest)
if (selection === 0) {
const form = new ModalFormData();
form.title("diamond_block");
form.slider("Slider", 0, 64, 1, 0);
form.show(player).then(res => {
if (res.canceled || res.formValues.length === 0) return;
const sliderValue = Number(res.formValues[0]);
if (isNaN(sliderValue)) return;
console.log("Slider number: " + sliderValue); // デバッグ用
// 計算処理
let scoreChange = Math.floor(sliderValue * 500);
if (sliderValue <= 1 || scoreChange <= 0) {
player.runCommand(`scoreboard players add @s eme -500`);
player.runCommand(`give @s iron_block ${sliderValue}`);
} else {
player.runCommand(`scoreboard players add @s eme ${scoreChange}`);
player.runCommand(`give @s iron_block ${sliderValue}`);
}
player.runCommand(`tellraw @s ${JSON.stringify({ "rawtext": [{ "text": "§l" }, { "text": "<shop> 。。。。。" }] })}`);
});
}
What the...? An error...?
Why are you doing number(res.formValues[0])
yes
It’s a question
1 item x 500g [1x]
32 items x 500g [32x]
64 items x 500g [64x]
Items = Money....
that's not what i asked