Here's my script:
local Mouse = game.Players.LocalPlayer:GetMouse()
local anime = script.Animation
Mouse.Button1Down:Connect(function()
print("IT WORKED")
anime:Play()
end)
It worked until I added the animation:Play()
Here's my script:
local Mouse = game.Players.LocalPlayer:GetMouse()
local anime = script.Animation
Mouse.Button1Down:Connect(function()
print("IT WORKED")
anime:Play()
end)
It worked until I added the animation:Play()
You gotta load the animation in the humanoid.
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local anime = humanoid:LoadAnimation(script.Animation)
anime:Play()
It doesn't work, I keep getting this error: LoadAnimation requires an Animation object
Oh oops, I meant script.Animation not script.Parent
That didnt work either It just says: Animation is not a valid member of LocalScript "Workspace.(My name).LocalScript"
It probably didn't load yet. try script:WaitForChild("Animation")
Its still doesnt work but we are getting somewhere because I dont get the error until I click. Right now the error i get is:Play is not a valid member of Animation "Workspace.Paczki_TCBC.LocalScript.Animation"
welp im all out of ideas
its ok
use :LoadAnimation([Animation]) and put script to StarterCharacterScripts
local Mouse = game.Players.LocalPlayer:GetMouse()
local anime = script.Animation
Mouse.Button1Down:Connect(function()
script.Parent.Humanoid:LoadAnimation(anime):Play()
end)
humanoid:LoadAnimation() is deprecated so its not reccomended, you should try humanoid.Animator:LoadAnimation()
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You need to load the animation to the Animator (character.Humanoid.Animator) not the HUMANOID because that is deprecated. And then you have to make the loaded one like this local thing = humanoid.Animator:LoadAnimation(anime) and then you can do thing:Play()