I don’t know why but the developer console/studio output tab still display error.
However the script can totally run perfectly.
Is it a display error?
It’s likely still working well due to it being in an event and only erroring in specific conditions which weren’t taken into account. In this case, check if the thing you’re using GetChildren
on is nil
, if it is, ignore the rest of the code and if it isn’t continue
The code is
player.Backpack:Connect(function(tool) --Line 3
... --function
end)
If it’s a real error,then the entire function will not work.
However,the entire function still work.
I guess it’s a display error.
I haven’t experienced this before so I am not really sure.
That means the player
variable is nil
, is this a localscript? I saw your previous post about problems with GetPlayerFromCharacter, if it’s a localscript you’d just need to get the localplayer, though if it’s a server script, maybe add a slight delay before getting the character. Though if everything still works with that error then you can just ignore it
No, it’s not.
It’s just a normal script in StarterCharacterScript
Ok,I will try adding a delay before the script runs
The script works fine after adding delay and no error displayed
If not game:IsLoaded() then
game.Loaded:Wait()
end
Thanks for helping me