const GemsTransfer = (player) => {
const players = [...world.getPlayers()];
new ModalFormData()
.title(`§dGems §aTransfer`)
.dropdown(`§a\nSelect The Player!`, players.map(plr => plr.name))
.textField(`\n§fEnter An Amount\nCurrent Balance: ${getScore(`Gems`, player)}`, `Only Use Numbers`)
.show(player)
.then(({ formValues: [dropdown,textField] }) => {
const selectedPlayer = players[dropdown];
if (selectedPlayer === player) {
overworld.runCommandAsync(`tellraw "${player.name}" {"rawtext":[{"text":"§cYou Cant Select Yourself"}]}`);
return;
} if (textField.includes("-")) {
overworld.runCommandAsync(`tellraw "${player.name}" {"rawtext":[{"text":"§cOnly Use Numbers"}]}`);
return;
}
if (getScore(`Gems`, player) < textField) {
overworld.runCommandAsync(`tellraw "${player.name}" {"rawtext":[{"text":"§cYou Dont Have Enough Gems"}]}`);
return;
} try {
overworld.runCommandAsync(`scoreboard players remove "${player.name}" Gems ${textField}`);
overworld.runCommandAsync(`tellraw "${player.name}" {"rawtext":[{"text":"§aSent ${selectedPlayer.name} §a$${textField}"}]}`);
overworld.runCommandAsync(`tellraw "${selectedPlayer.name}" {"rawtext":[{"text":"${player.name} §aHas Given You §a$${textField}"}]}`);
overworld.runCommandAsync(`scoreboard players add "${selectedPlayer.name}" Gems ${textField}`);
} catch {
overworld.runCommandAsync(`tellraw "${player.name}" {"rawtext":[{"text":"§cOnly Use Numbers"}]}`);
return;
}
}).catch((e) => {
console.error(e, e.stack);
});
};```
#Money Transfer Doesn't Work
1 messages · Page 1 of 1 (latest)
okay thank you
Here, if its not working dm me
i didnt had time to test it
okay]
So many cmds
for the multi-use
wait
wait
what
idk
wait a second
okay
im gonna debug it wait
okay
here @sharp dawn
got the error
errors
thank you
?
@sharp dawn
"None" if if no player is being selected, i removed that the user is being shown and a empty list would be looking stupid i think
so i added just "none"
oh okay thank you
Dm me if there is any error
okay
Wirt
WAIT
i saw something ^^
I forgot the edit this line
if (dropdownIndex !== 0) { return; };
@sharp dawn edit this line to
if (dropdownIndex === 0) { return; };
okay
i hate scoreboard and ui stuff
yeah
well have fun with your oversized script, called MULTI USE
yeah lol
@sharp dawn
shouldnt be my error
idk why but when 2 or more player are in the world it doesnt work
show me the line
wait
thats weird
yeah
ohhh
i see
wait
ill resend the GemsTransfer function
okay
here
thank you
sure
done it again when i get 2 players in
@sharp dawn
lol i forgot to add something
// replace this array: "[ '§cNone Selected', ...players ]"
// with this:
[ '§cNone Selected', ...getPlayerNames(players) ];
when i try to send it, it says this
where do i make input go?
wait what
oop
change it to inputText
noted for me,
next time ill check the script properly and ill test it before ingame
this?
.
eys
yes**
?
oops, change it also to inputText ^^
not
not
wait
do i change it to Gems?
to amount to gems
shit wifi
amount to gems?
yes
okay
it doesnt work
and theres no error
it just says i have no money?
@sharp dawn
sorry about this
it says you dont have enough, means less than you want to pay
lol
im giving less than i want to pay
i got so many errors in there
ahhhhh
getGems(player) > gems
// to
getGems(player) < gems
just change the little operstr
operator*
okay
it doesnt take any away or send the other person a message
.
uhhhh
it should send it if anything is working
its not
sorry about this
no problem. hmmm
thats weird
yeah
oh
they are still amount
lol
change it also to gems
yeah lol
im trying to make a SimulatedPlayer addon, next time i can test the whole addon by using the SimulatedPlayer as a real player, so no errors in future ^^
oh thats really cool
but im struggling rn
So does it works now?
with what?
yep
perfect
yay
wow
okay dm me if there are other problems
okay
with what?
spawning the player
everytime i spawn him a fucking ugly structure gets also spawned