So I have been working on my game with animations. Everything works fine first time until I reset my character, this error pops out:
Code:
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAppearanceLoaded:Wait()
local hum = char:WaitForChild("Humanoid")
local animator: Animator = hum:WaitForChild("Animator")
local anims = {
idle = animator:LoadAnimation(animsFolder.Idle), --Error pops out in this table
shoot = animator:LoadAnimation(animsFolder.Shoot),
reload = animator:LoadAnimation(animsFolder.Reload),
}
I have seen a lot of topics about that but none of it helped me. Any help appreciated!
Found a solution. Need to write this to get character:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end