CuteLittleSpark Posted September 13, 2023 Share Posted September 13, 2023 I've been trying to add my leaderboard skript below to work with a skript i found recently but it doesn't seem to work I think its a easy fix but im not sure if it is or if i should just give up .hope you guys can help im new to skripting but everyone seems way smarter at this. (when i try to buy something it says im too poor when i have more than enough on the leaderboard) any advice or help is appreciated every 5 seconds: loop all players: wipe loop-player's sidebar set name of sidebar of loop-player to "&b&lDeath Plunder" set score "" in sidebar of loop-player to 10 set score "&bRank:" in sidebar of loop-player to 9 replace all "[" and "]" with "" in {_prefix} replace all "[" and "]" with "" in {_suffix} if length of {_suffix} is greater than 2: set score " %{_prefix}% &8+ %{_suffix}%" in sidebar of loop-player to 8 else: set score " %{_prefix}%" in sidebar of loop-player to 8 set score "&d" in sidebar of loop-player to 7 set score "&bMoney&8:" in sidebar of loop-player to 6 set score " &f%loop-player's balance%" in sidebar of loop-player to 5 set score "&e" in sidebar of loop-player to 4 set score "&bOnline&8:" in sidebar of loop-player to 3 set score " &f%number of all players%&8/&f100" in sidebar of loop-player to 2 set score "&2" in sidebar of loop-player to 1 Here is the shop skript:------------------------ ptions: shopname: &6&lShop defname: &a&lDefense genname: &b&lGens msg: &8[&3Shop&8] &3 function buy(p: player, i: integer, m: string, it: itemtype): set {_uuid} to uuid of {_p} if {balance::%{_uuid}%} >= {_i}: remove {_i} from {balance::%{_uuid}%} give {_p} {_it} named {_m} send "{@msg}Bought 1 %{_m}% &3for $%{_i}%" to {_p} else: send "{@msg}Too poor" to {_p} command /shop: trigger: set metadata tag "shop" of player to chest inventory with 1 row named "{@shopname}" set slot 0 of metadata tag "shop" of player to iron bars named "{@defname}" set slot 1 of metadata tag "shop" of player to hay bale named "{@genname}" open (metadata tag "shop" of player) to player on inventory click: if event-inventory = (metadata tag "shop" of player): cancel event if index of event-slot is 0: set metadata tag "shopDef" of player to chest inventory with 6 rows named "{@defname}" set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 of metadata tag "shopDef" of player to black stained glass pane set slot 10 of metadata tag "shopDef" of player to stone brick named "&7&lTier 1 Defense Block" with lore "", "&aPrice: $5000" and "" set slot 11 of metadata tag "shopDef" of player to basalt named "&7&lTier 2 Defense Block" with lore "", "&aPrice: $20000" and "" set slot 12 of metadata tag "shopDef" of player to polished deepslate named "&7&lTier 3 Defense Block" with lore "", "&aPrice: $100000" and "" set slot 13 of metadata tag "shopDef" of player to iron trapdoor named "&f&lTier 2 Trapdoor" with lore "", "&aPrice: $25000" and "" set slot 14 of metadata tag "shopDef" of player to beacon named "&b&lRespawn Block" with lore "", "&aPrice: $20000" and "" open (metadata tag "shopDef" of player) to player if index of event-slot is 1: set metadata tag "shopGen" of player to chest inventory with 6 rows named "{@genname}" set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 of metadata tag "shopGen" of player to black stained glass pane set slot 10 of metadata tag "shopGen" of player to white glazed terracotta named "&fWhite Generator &8[&6T1&8]" with lore "", "&aPrice: $100" and "" open (metadata tag "shopGen" of player) to player if event-inventory = (metadata tag "shopDef" of player): cancel event if index of event-slot is 10: buy(player, 5000, "&7&lTier 1 Defense Block", stone brick) if index of event-slot is 11: buy(player, 20000, "&7&lTier 2 Defense Block", basalt) if index of event-slot is 12: buy(player, 100000, "&7&lTier 3 Defense Block", polished deepslate) if index of event-slot is 13: buy(player, 25000, "&f&lTier 2 Trapdoor", iron trapdoor) if index of event-slot is 14: buy(player, 20000, "&b&lRespawn Block", beacon) if event-inventory = (metadata tag "shopGen" of player): cancel event if index of event-slot is 10: buy(player, 100, "&fWhite Generator &8[&6T1&8]", white glazed terracotta) Link to comment Share on other sites More sharing options...
Adramelke Posted October 1, 2023 Share Posted October 1, 2023 replace all "[" and "]" with "" in {_prefix} replace all "[" and "]" with "" in {_suffix} if length of {_suffix} is greater than 2: set score " %{_prefix}% &8+ %{_suffix}%" in sidebar of loop-player to 8 else: set score " %{_prefix}%" in sidebar of loop-player to 8 {_variable} is a local variable that has to be set in the same even/trigger before it can be used?? either change it to a constant one {variable} or reset the variable before using it (set {_variable} to "thing":) function buy(p: player, i: integer, m: string, it: itemtype): set {_uuid} to uuid of {_p} if {balance::%{_uuid}%} >= {_i}: remove {_i} from {balance::%{_uuid}%} give {_p} {_it} named {_m} send "{@msg}Bought 1 %{_m}% &3for $%{_i}%" to {_p} else: send "{@msg}Too poor" to {_p} Link to comment Share on other sites More sharing options...
CuteLittleSpark Posted October 7, 2023 Author Share Posted October 7, 2023 thanks for replying sorry im not 100 percent sure what to do could u explain it a little simplier for me if you can. are u saying o should replace some of the skript with the one your provided (sorry im a bit slow somtimes) the bit i dont understand is changing and to with ""in ill still try to do it with the infomation provided but im just a little comfused sorry. appreciate that your replied tho . so thanks. if your have any time to clarify more or shwo me what you mean it woul.ld be great but if not ill just keep trying . thanks again The more i keep re-reading this again and again i realised what you were saying more and more ill try replace my skript with the one provided hopefully it works what is the best way to make it a constant variable tho loop all players or something im lost again ;-; MOD NOTE: Please use the edit button instead of making a new post. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now