So recently I encountered a problem when coding another tool;
the preceding code block;
local players = game:GetService("Players").LocalPlayer
local character = players.Character
repeat wait() until players.Character
local humanoid = character.Humanoid
The confusion I’m facing here, is that the same line of code it’s referring to is used in 6 other tools, while those don’t give me errors. Yet this one does? I’m drawing blanks here, so if anyone knows, please me know!
This has been happening to me a lot too. I think in some cases the script loads faster than the character and all it’s parts, so this error pops up. The thing is, even though I use a WaitForChild(), it still happens.
This half-fixed the problem. It ended up trying to look for Character inside the player model. Which I don’t quite understand how that happened. I ended up just switching where the wait was and it’s fixed. Thanks!