I’m insanely confused. For a while, my game has been giving me small issues from certain features not working because my Humanoid was dead, when the player was clearly alive, and now today, my gun script is ceasing to work completely, and I noticed it only happens when my script prints Enum.HumanoidStateType.None.
What even is this, and what can I do to fix it?
I know it’s nothing wrong with my gun scripts because I’ve had them reviewed probably over 10+ times now. I can’t seem to find any issues with them. It only breaks my scripts sometimes when I spawn in. It’s a random chance that the engine decides it’ll work or not.
I noticed that it only breaks scripts that use if statements that rely on Humanoid State types.
Gun works normally when this is printed:
Gun does not work properly when this is printed:
Is there any methods in a script that I can use to possibly fix this? Is this a common HumanoidStateType error? The Roblox documentation page says it’s an unusable placeholder, but I have no clue what that even means.
Placeholder: Something taking the Place of something ( or Google Definition ) (Ex: There is an Update Coming out. there is a Placeholder Detail to Mark for that occasion temporarily until it comes out)
Unusable: Cannot be Used
I don’t think it means that it wont appear, it just means that you cant use it, and the triggered internally part just means it can only be used by CoreScripts and other stuff related to that, Since it appears to be triggered by an unknown State, that might be why you are getting this.
I Cannot find any relevant Links for HumanoidStateType.None, The Only real thing related is that “apparently” it is just when the Humanoid isn’t doing anything, I doubt this and I’ll continue to look into it.
My friend suggested I do a few things, like checking to see if humanoid states are all enabled and stuff, and we didn’t discover any real difference.
They also tried replicating the issue, but this unfortunately didn’t show us anything too alarming.
I’ll need to figure out a way to submit a bug report while I prepare the stuff for this. As far as I am aware, there is no possible fix for this. My scripts are (unfortunately) going to have to break until it somehow fixes itself one day.
Thanks for the help, I’ll leave this post unsolved if someone somehow figures something out.
I found out the issue, and it appears to be resolved, but as with most things in this engine it’ll find another way to inconvenience me.
Turns out if you try indexing the Humanoid in certain ways, I guess the script holds onto some form of unprepared humanoid or something and always returns Enum.HumanoidStateType.None because the index at the time probably stored an unready Humanoid that was probably nil.
I even got this result by deleting the humanoid and quickly firing the gun when the gun was working just fine, and it returned the Enum.HumanoidStateType.None naturally. As for the state checker script, that was removed prior to getting that result.
Apparently yielding the script at the beginning gives the script time to index the correct humanoid.
I still don’t get how it was working sometimes, and sometimes not, but this was the closest lead I had, and putting
script.Parent.Tool.Equipped:Wait() somehow fixed the issue.