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}%"
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}%"