The part of my script that is causing a problem is this.
Even though the Humanoid is gotten via (WaitForChild) and I repeat wait until the Humanoid is loaded. It still gives me this error when it tries to load the animations for my tool.
The part of my script that is causing a problem is this.
Try adding this at the top of your script to make sure that the character is in the workspace
while char.Parent == nil do
char.AncestryChanged:wait()
end
Thanks something like that worked I dont know why I didnt think of that before
Does it matter at all? It helped to solve this problem
It is matter. Instead of copy and pasting the code from someone else on the forum you should give them a credit and send a link to the threads solution. Itâs practically more professional and more secure. Thanks for your understanding.
(@Raretendoblox) Whatâs to say he didnât make it himself. Itâs a universal script, not just one person.
I agree @CheeseRespect2019 its 3 lines of really common code, and @ArticGamerTV your not even sure he got that bit from Gamer101âs post. Stop arguing about these small details. @Raretendoblox thanks for your help
@CheeseRespect2019 He did created it, he was the first reply on the topic. There are slightly more ways to fix that problem and also as you called this script âuniversal scriptâ. @Legenderox He litterally took the same variables names and everything. Coincidence? I think not. I am not even close to arguing with him, I am literally teaching him how to correctly use forums. Thanks to both of you for your understanding.
No he didnât though. You canât prove it. Simple code, OK?
Isnât :wait()
deprecated in favor of :Wait()
?
I thought it was lowercase no?
Yep, it is, actually
30 characters
Something is wrong. When I use that bit of code you sent in my script. If I respawn it just ends up waiting for ever even after the character is fully loaded.
Tools run their LocalScripts immediately after they are enabled (happens after game.Loaded fires). Unfortunately, this also means that youâre experiencing the issue where Humanoid doesnât necessarily exist as in when CharacterAdded fires.
I donât remember the exact process for guarding against this when needing the Humanoid as an upvalue but it requires waiting for tons of signals to fire. The new character sound script has the code for this if you need it.
The best way to get around this is to load your animations from the Equip method and make sure to only do it once.
I tried that too, but the script ended up refferring to the wrong characer everytime it reset and I had to manually set all the values again after every death.
This is something similar to what @Raretendoblox has said.
character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:Wait()
end