I am making a captcha skript , it has a feature that wont let you close your inventory until you click the green glass, when i close my inventory it sends the error message (Please complete the captcha) but it sends it so many times skript gives the "main.sk looped infinitley" error. Ive tried asking my friend who is experienced in skript but he doesnt know, here is the part of the code that has the error:
Code:
on inventory close:
if {doingcaptcha::%player%} is true:
send "{@prefix} Please complete the captcha!"
set {_captcha} to a random number between 1 and 26
open virtual chest named "&cCaptcha" to player
format gui slot 0 and 1 and 2 and 3 and 4 and 5 and 6 and 7 and 8 and 9 and 10 and 11 and 12 and 13 and 14 and 15 and 16 and 17 and 18 and 19 and 20 and 21 and 22 and 23 and 24 and 25 and 26 of player with red stained glass pane named " " to run:
add 1 to {fails::%player%}
if {fails::%player%} is greater than 4:
kick player due to "{@prefix} Captcha Failed!"
set {fails::%player%} to 0
set {doingcaptcha::%player%} to false
format gui slot {_captcha} of player with green stained glass pane named "&aClick Me!" to run:
close player's inventory
send "{@prefix} Successfuly completed captcha!"
set {doingcaptcha::%player%} to true
delete {_captcha}