Speed item help

Started by DerpyOreo on

Topic category: Help with MCreator software

Joined Mar 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Speed item help
Thu, 08/13/2020 - 15:21 (edited)

In my mod, I'm making an item where if its in your inventory, it gives you speed, but if its not in your inventory it doesnt.
I did this
While the player has the speed item in inventory, give effect speed 1 for 1 second.

The game crashes when I put the item in my inventory.

Help!

(also if you dont have a secure connection, thats my bad because im using my website for the image LOL)

Edited by DerpyOreo on Thu, 08/13/2020 - 15:21
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So I tried what you have and…
Fri, 08/14/2020 - 07:30

So I tried what you have and it crashed, switched it to an if do statement and it worked. Don't forget the on player tick update trigger.

sugar

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Generally don't use while()…
Fri, 08/14/2020 - 11:25

Generally don't use while() statements in a procedure that runs every frame if you can use an if() statement instead.

The game crashes when I put…
Fri, 08/14/2020 - 11:27

The game crashes when I put the item in my inventory.

Your while loop locks the game from doing anything else, but checking for inventory item so it lags, freezes, and crashes