Jump to content

set {variable} to {variable} + 1 not working


TheHunter

Recommended Posts

I'm making a skript that should open a GUI where you can upgrade the efficiency level by right clicking a diamond pickaxe. The efficiency level should rise by one everytime you click the enchanted book in the GUI, but it only enchants it to level 1 and when I click it again it doesn't do anything.

Here's the skript:

variables:
    {_eff} = 1

on right click:
	player is holding a diamond pickaxe:
		open virtual chest with 1 row named "Enchanting" to player
		format gui slot 0 of player with enchanted book named "&eEfficiency" to run:
			enchant player's tool with "efficiency %{_eff}%" parsed as enchantment type
			set {_eff} to {_eff} + 1

I also tried this but it didn't work either:

variables:
    {_eff} = 1

on right click:
	player is holding a diamond pickaxe:
		open virtual chest with 1 row named "Enchanting" to player
		format gui slot 0 of player with enchanted book named "&eEfficiency" to run:
			enchant player's tool with "efficiency %{_eff}%" parsed as enchantment type
			add 1 to {_eff}

 

Edited by TheHunter
Link to comment
Share on other sites

Thats not how local variables work. If you are trying to enchant with one level higher, just get the player's current efficiency level then increase it by one. 

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Community Support - 7/8/20 - 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - 12/20/22

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...