Alakazizam Posted July 13, 2023 Share Posted July 13, 2023 I'm trying to set a variable on start from my inventory but it sets it to 0. I'm assuming because it's triggering before the character is actually loaded in. How can I go about this? Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted July 13, 2023 Share Posted July 13, 2023 5 hours ago, Alakazizam said: I'm trying to set a variable on start from my inventory but it sets it to 0. I'm assuming because it's triggering before the character is actually loaded in. How can I go about this? onStart should always run after being logged in, very rarely it could happen earlier. You sure your code is correct? I use this in a lot of my scripts and never heard of an issues with this 1 Quote Link to comment Share on other sites More sharing options...
Delivery Posted July 13, 2023 Share Posted July 13, 2023 7 hours ago, Alakazizam said: I'm trying to set a variable on start from my inventory but it sets it to 0. I'm assuming because it's triggering before the character is actually loaded in. How can I go about this? how about setting the default value to null and make it get the count in the onloop if the var is still null 1 Quote Link to comment Share on other sites More sharing options...
Alakazizam Posted July 13, 2023 Author Share Posted July 13, 2023 4 hours ago, Khaleesi said: onStart should always run after being logged in, very rarely it could happen earlier. You sure your code is correct? I use this in a lot of my scripts and never heard of an issues with this I'll have to try again. Was burnt out this morning and may have messed up some maths lol 2 hours ago, xcx said: how about setting the default value to null and make it get the count in the onloop if the var is still null Going to try to get the onStart method working again, but if that doesn't work out this is probably a good work around. Quote Link to comment Share on other sites More sharing options...
Delivery Posted July 14, 2023 Share Posted July 14, 2023 1 hour ago, Alakazizam said: I'll have to try again. Was burnt out this morning and may have messed up some maths lol Going to try to get the onStart method working again, but if that doesn't work out this is probably a good work around. I mean if it really won't load the inventory, could do a conditionalSleep until myPlayer().exists(); or getInventory() !=null 1 Quote Link to comment Share on other sites More sharing options...