Animations Disappear after death

This is all in a local script the problem is that the animations revert to the unupdated animation after player death.

I have no clue why. I’ve tried putting the update function above the animation part of the script but ofcourse that didn’t work

local punchAnims = {
	'rbxassetid://17783816450',-- punch 1
	'rbxassetid://17783822840', -- punch 2
	'rbxassetid://17783832070',-- kick 1
	'rbxassetid://17783869300', -- last punch


local airAnims = {

local function updateAnimations(newPunchAnims, newAirAnims)
	print("Updated anims")
	punchAnims = newPunchAnims
	airAnims = newAirAnims

-- Listen for the server to send new animations
1 Like

Can you send the server-sided script for us?

this is the data store script updated anims


  • Server script (e.g., in ServerScriptService)

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local Factors = require(game.ServerScriptService:WaitForChild(“Factors”)) – Adjust path as needed

– Server Script in ServerScriptService
local Players = game:GetService(“Players”)
local DataStoreService = game:GetService(“DataStoreService”)
local EquippedFactorStore = DataStoreService:GetDataStore(“EquippedFactorStore”)

– Function to load data when player joins
local equippedFactor = “BasicFactor”
local success, savedFactor = pcall(function()
return EquippedFactorStore:GetAsync(player.UserId)

if success and savedFactor then
	equippedFactor = savedFactor
	EquippedFactorStore:SetAsync(player.UserId, equippedFactor)

player:SetAttribute("EquippedFactor", equippedFactor)
-- Function to update animations
local function updateAnimations(character)
	local factor = equippedFactor
	if Factors[factor] then
		local punchAnims = Factors[factor].punchAnims
		local airAnims = Factors[factor].airAnims

		-- Send the updated animations to the client
		local remote = ReplicatedStorage:WaitForChild("combatnet")
		remote:FireClient(player, punchAnims, airAnims)

-- Connect the function to when the character is added

-- If the player already has a character when they join
if player.Character then


– Function to save data when player leaves
local equippedFactor = player:GetAttribute(“EquippedFactor”)
EquippedFactorStore:SetAsync(player.UserId, equippedFactor)

– RemoteEvent to change the equipped factor
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local ChangeEquippedFactor =“RemoteEvent”)
ChangeEquippedFactor.Name = “ChangeEquippedFactor”
ChangeEquippedFactor.Parent = ReplicatedStorage

ChangeEquippedFactor.OnServerEvent:Connect(function(player, newFactor)
player:SetAttribute(“EquippedFactor”, newFactor)
EquippedFactorStore:SetAsync(player.UserId, newFactor)


There’s two possible reasons for your issue:

  1. Your server script is not sending a table or data, you should try logging those to see if they’re actually sending something.
  2. You’ve already loaded the animations on the local script, making it still being displayed has the outdated versions of the animation.

When i join the game the animationsa re updates but when I die in the game they return to unupdated anims

Try changing

local factor = equippedFactor


local factor = player:GetAttribute("EquippedFactor")

the PlayerAdded:Connect only runs once so when you die it doesn’t update the animations again.
you can do CharacterAdded:Connect instead

CharacterAdded needs a player instance to be fired.

Another possible solution for you is to move the script from StarterCharacterScripts (or whatever parent it’s currently set) to StarterPlayerScripts.

1 Like