Quite simply, I just have a plain
Player.CharacterAdded:Wait()
in a script. This is what it yields in the output.
After this, the rest of the script refuses to run.
Can this be fixed?
Quite simply, I just have a plain
Player.CharacterAdded:Wait()
in a script. This is what it yields in the output.
After this, the rest of the script refuses to run.
Can this be fixed?
Your Player
variable is nil. I assume you used Players.LocalPlayer
on a server script, which doesn’t work. Although you can get the tool player reference relative to the script from this path:
--Script --> Handle --> Can --> Backpack --> Player
local Player = script.Parent.Parent.Parent.Parent
Jut use
local character = Player.Character or Player.CharacterAdded:Wait()
instead of
local character = Player.CharacterAdded:Wait()
I already tried this before posting the topic, still thinks I’m indexing nil
Try printing player name player:GetFullName() and see if player actually exists i agree with @KristinaMoment
script:FindFirstAncestorOfClass("Player")
Can you share the entire script? We can’t really fix your code without it.
If the character dies or respawns this happens. Instead use:
player.CharacterAdded:Connect(function(character)
end)
or put it under StarterCharacter.
It’s the same thing as player.CharacterAdded:Wait() instead it doesn’t yield
Post your actual script if you want more help beyond that.
Line 3
Change the script to a LocalScript
I’ve changed it to a localscript as one of you have said that it will not work in a server script. The error fixes itself, but it now says Infinite yield possible with Character:WaitForChild("Animator")
note: yes I’m novice at scripting, don’t mind me making dumb errors
Animator would be a child of Humanoid
, not Character
It works now, but no animation plays. However, I did add a massive amount of numbered print statements which did print. I’ll definitely check the animation before anything though, but this did fix the scripting side of the issue. Thanks!