Hello devs! I’m making a simple death animation script, but I need some help witht the animation part
Code -
local Players = game.Players.LocalPlayer
local char = Players.char
char.Archivable = true
char.Humanoid.BreakJointsOnDeath = false
wait()
char.Humanoid.Died:Connect(function()
local clone = char:Clone()
clone.Parent = game.Workspace
clone:SetPrimaryPartCFrame(char.CFrame)
end)
How do I add an animation into the cloned Character?
1 Like
local animation = Instance.new("Animation")
animation.AnimationId = ... -- The id of the animation that you made
local loadedAnimation = char.Humanoid:LoadAnimation(animation)
loadedAnimation:Play()
I wanted the clone to have the animation, though
The cloned character also has a humanoid and can be animated, so I don’t find the problem in that (you just do clone.Humanoid:LoadAnimation(animation))
The char is the clone, just change the name.
So it would be like this.
local Players = game.Players.LocalPlayer
local char = Players.char
char.Archivable = true
char.Humanoid.BreakJointsOnDeath = false
wait()
char.Humanoid.Died:Connect(function()
local clone = char:Clone()
clone.Parent = game.Workspace
clone:SetPrimaryPartCFrame(char.CFrame)
local animation = Instance.new("Animation")
animation.AnimationId = ... -- The id of the animation that you made
local loadedAnimation = clone.Humanoid:LoadAnimation(animation)
loadedAnimation:Play()
end)
2 Likes
I tried that. Didn’t work for some reason
Ty for helping, but I figured it out 
1 Like