Good. I need help with this error, and I really don’t know what the problem is. My problem is that the script can’t find the Humanoid or I don’t know, it just gives an error.
local PlayAnim = script.Parent:WaitForChild("PlayAnim")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local AnimationTrack = Character:WaitForChild("Humanoid"):LoadAnimation(PlayAnim)
2 Likes
Change your code to the code below. It could be that the character isn’t added into the player yet.
local PlayAnim = script.Parent:WaitForChild("PlayAnim")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait() -- Index the current character, or grab the one from CharacterAdded when that event fires.
local AnimationTrack = Character:WaitForChild("Humanoid"):LoadAnimation(PlayAnim)
3 Likes