LoadAnimation is not working

I am trying to if player click part, then load animation to player
but my script is not working.
and I cant find any error log
why does my script is not working? gimme solution please

`local bom = script.Parent
local anim = Instance.new(“Animation”)
anim.AnimationId = “rbxassetid://6658673153”

bom.ClickDetector.MouseClick:Connect(function(plr)

local punch = plr.Character.humanoid:LoadAnimation(anim)

punch:Play()

end)`

image

try making the letter ‘h’ in .humanoid a capital letter

local punch = plr.Character.Humanoid:LoadAnimation(anim)

2 Likes

how much varibles do you have? Just those? Also is there anything else in that script other than
local punch = plr.Character.humanoid:LoadAnimation(anim)

punch:Play()
?

Also do try what @JasutinPoru said about turning humanoid to Humanoid

1 Like
local punch = plr.Character.Humanoid.Animator:LoadAnimation(anim)

punch:Play()
1 Like

oh thanks! script is working now :smiley:

1 Like

ur welcome :slight_smile: u can also use @THECOOLGENERATOR’s suggestion because loading animations on .Humanoid is deprecated now, u should load animation on the .Humanoid.Animator instead

1 Like