#Team Skript
1 messages · Page 1 of 1 (latest)
I mean like swap the player skull to dirt and also idk how to debug
x8ight suggests that you read this embed
Debugging is the process of finding and fixing bugs/issues/errors within your code. For a more detailed explanation on proper debugging check out sovdee's page
Since you don't see the value of variables it can be easy to assume that everything is working properly even though that might not be the case. Variables and arguments in functions and commands might change throughout your code in unexpected ways. It is a good idea to broadcast your variables at different points in your code to confirm that the value is what you expect it to be.
on chat:
broadcast {chats::%player's uuid%}
add 1 to {chats::%player's uuid%}
broadcast {chats::%player's uuid%}```
In this example we broadcast the variable to check its value before and after we add to it to make sure the value goes up. If the variable was set to a string (`set {chats::%player's uuid%} to "3"`) then we would be able to see that the value did not go up, alerting us of the issue.
If your code does no seem to be doing anything it is a good idea to establish which parts of your code are being executed, especially when using conditions. To accomplish this, add a broadcast after each part of line of your code with a descriptive message.
on right click:
broadcast "player clicked"
if player's tool = iron sword:
broadcast "player's tool was iron sword"
set player's tool to diamond sword```
In this example, we would only see the `player clicked` message if the player was holding an apple, alerting us that the code stopped after the first condition.
loop {team::%{team::%uuid of {_p}%}%::*}:
set {_money::%loop-value's name%} to loop-value's balance
set {_money2::*} to sorted indices of {_money::*} in descending order
loop {_money2::*}:
if loop-iteration is 44:
stop
else if {statistics::%uuid of loop-value%} is true:
broadcast "%loop-value%"
set slot {_x} of metadata tag "team" of {_p} to stone named "&b%loop-value%" with lore "&a&l$&r &fMoney: &a%format(loop-value's balance)%", "&4🗡 &fKills: &4%format({kills::%uuid of loop-value%})%", "&6☠&fDeaths &6%format({deaths::%uuid of loop-value%})%"
add 1 to {_x}
else:
set slot {_x} of metadata tag "team" of {_p} to stone named "&b%loop-value%"
add 1 to {_x}
open metadata tag "team" of {_p} to {_p}``` why is there no lore like I added in the code
and {statistics::%uuid of player%} is true for me
are you sure?