So I’m trying to animate an eel, by playing a swimming animation when its moving. But it seems that humanoid:LoadAnimation() doesn’t actually work anymore or maybe I’m doing it wrong. Here’s the code I am running
while wait() do
local Swim = script.Parent.Animations.Swim
local PlayerNear = false
local PlayerHRP
local players = game.Players:GetPlayers()
for i, v in pairs(players) do
local Character = game.Workspace:WaitForChild(v.Name)
if (Character.HumanoidRootPart.Position - script.Parent.HumanoidRootPart.Position).Magnitude < 5 then
print("Near")
PlayerNear = true
PlayerHRP = v.Character.HumanoidRootPart
end
end
if PlayerNear == true then
script.Parent.HumanoidRootPart.BodyPosition.Position = PlayerHRP.Position
script.Parent.HumanoidRootPart.CFrame = CFrame.new(script.Parent.HumanoidRootPart.Position, PlayerHRP.Position)
local SwimAnimation = script.Parent.Humanoid:LoadAnimation(Swim)
end
end
In the script it underlines script.Parent.Humanoid:LoadAnimation. So what I’m guessing is that it does not work anymore, but I don’t know what else to do since I can’t find anything about it anywhere. Does anybody know why this is happening? And what should I do instead to fix this.