Variable do not "communicate"

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Nils Møller

Member
Jan 22, 2021
3
0
1
23
My script do not communicate as it should.

It is suppose to add x to {_antal} when the green wool is clicked but the diamond in the middle don't change

command /coinflip:
trigger:
set {_antal} to 1
open chest with 1 row named "&4&lCoinFlip" to player
wait 1 tick
set slot 0 of player's current inventory to 10 of red wool named "-10 diamanter"
set slot 1 of player's current inventory to 5 of red wool named "-5 diamanter"
set slot 2 of player's current inventory to 1 of red wool named "-1 diamant"
set slot 4 of player's current inventory to {_antal} of diamonds named "%{_antal}% diamanter"
set slot 6 of player's current inventory to 1 of green wool named "+1 diamant"
set slot 7 of player's current inventory to 5 of green wool named "+5 diamanter"
set slot 8 of player's current inventory to 10 of green wool named "+10 diamanter"

on inventory click:
if inventory name of player's current inventory is "&4&lCoinFlip":
send "%{_antal}%"
name of clicked item is "-10 diamanter":
cancel event
reduce {_antal} by 10
update the inventory player
wait 1 tick
send "%{_antal}%"

name of clicked item is "-5 diamanter":
cancel event
reduce {_antal} by 5
update the inventory player
send "%{_antal}%"

name of clicked item is "-1 diamant":
cancel event
reduce {_antal} by 1
update the inventory player
send "%{_antal}%"

name of clicked item is "+1 diamant":
cancel event
increase {_antal} by 1
update the inventory player
send "%{_antal}%"

name of clicked item is "+5 diamanter":
cancel event
increase {_antal} by 5
update the inventory player
send "%{_antal}%"

name of clicked item is "+10 diamanter":
cancel event
increase {_antal} by 10
update the gui player
send "%{_antal}%"
 
Status
Not open for further replies.