local animations = {
"13123760883", "13123772558", "13123778553", "13123786180"
}
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player) -- function is called when a player is added
player.CharacterAdded:Connect(function(character) -- function is called when the player's has spawned
local humanoid = character:WaitForChild("Humanoid")
humanoid.BreakJointsOnDeath = false
humanoid.Died:Connect(function() -- function called when the player die
local anim = Instance.new("Animation", character)
anim.AnimationId = "rbxassetid://"..animations[math.random(1, 4)]
character.PrimaryPart.Anchored = true
--This is another variant, when animation is a child of this script. Not working
--local track = humanoid.Animator:LoadAnimation(script:FindFirstChild("Death"..tostring(math.random(1, 4))))
local track = humanoid.Animator:LoadAnimation(anim)
track:Play()
track.Stopped:Wait()
anim:Destroy()
end)
end)
end)
So, I also put script like this in StarterCharacterScripts, in both ways script is called, but animation not playing, why it’s happened, where mistake?
Thanks for answer. I try put script in startcharacterfolder script, I understand that this should work, but the animation is not playing. The character is frozen for the duration of the animation, and then respawns. I can’t understand what is the problem
try printing the time it took for the animation to play by saving current tick() before you start the animation the comparing it with the tick after the animation finished. What might happen is all animations are stopped or never played on dead humanoids
I try set to true and false…animation not playing. I try many death animation solution from this forum, in last roblox studio died animation not working. Where mistake?
and get this:
15:03:46.050 Start animation tick: 1681743825.2626426 - Server - Death:31
15:03:47.947 Stop animation tick: 1.897036075592041 - Server - Death:35
So animation is started and runnnig, but not displayed.
Ok, humanoid is die all animation it’s stopped and never playing on dead,
but how show animation for this event, if “Died” event not suitable?
Just a suggestion but I would prefer to use os.clock() as it is extremely accurate at benchmarking and time tracking. Also because tick() is soon to be deprecated due to it’s unreliability as stated in the announcement