When I call this function it shows the error you see above.
function FX:Animate()
RunService.Stepped:Wait()
local track = Humanoid.Animator:LoadAnimation(CheckpointAnims.Pray)
track:Play()
task.delay(self.PrayCooldown,track.Stop,track)
end
I tried using this post to fix my issue but it didn’t work.
Animations can only load while the animator is parented to anything under the workspace, are you sure the character is in the workspace when you load it?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
local Assets = ReplicatedStorage.Assets
local Animations = Assets.Animations
local CheckpointAnims = Animations.Checkpoint
local VFX = ReplicatedStorage.VFX
local CheckpointVFX = VFX.Checkpoint
local FX = {}
FX.__index = FX
function FX.new(cd)
local self = setmetatable({},FX)
self.PrayCooldown = cd
self.NewDust = CheckpointVFX.GoldDust:Clone()
return self
end
function FX:Pray()
self:Particles()
self:Animate()
end
function FX:Particles()
self.NewDust.Position = Root.Position
self.NewDust.Attachment.ParticleEmitter.Enabled = true
self.NewDust.Parent = workspace
task.delay(self.PrayCooldown,self.NewDust.Destroy,self.NewDust)
end
function FX:Animate()
RunService.Heartbeat:Wait()
local track = Humanoid.Animator:LoadAnimation(CheckpointAnims.Pray)
track:Play()
task.delay(self.PrayCooldown,track.Stop,track)
end
return FX