Replicating the default Animate script and it's not animating as Server Sided

What do I want to achieve?
I want to make the Animate script that is replicated onto a character when you switch characters to be Server Sided. (Visible on all clients.)

What’s the issue?
This wasn’t an issue a few weeks ago, I have 0 clue on what made the animate script not server sided when being replicated. However, the issue is that the Animate script is no longer visible on all clients. (You can only see yourself being animated.)

I’ve tried searching on how to fix this issue, and I couldn’t find anything. I’ve also checked all of my other scripts and there shouldn’t be anything causing the animations to only be client sided.
This morning, I did see a post about Roblox studio default animations not playing. It should be fixed by now and I’m not too sure if that’s what’s causing the Animations to be client sided.

The script is a LocalScript which is in ReplicatedStorage so that it gets put onto the character that you switch to. (Since when you switch characters, the animate script isn’t there by default.)

Note: I do not know how to script lua, I paid my friend to script everything in my game. Everything in my game used to work normally until last night.
If you need more information, let me know!

In simple words, I want the default roblox Animate script to work server sided instead of client sided

Just a question, by the sentence:

Since when you switch characters, the animate script isn’t there by default.

Does this mean putting the LocalScript in StarterCharacterScripts does not apply to the switched character?

Yes, but to counter this I made it so that when you click a gui button it changes your character and a copy of the Animate script that’s inside of ReplicatedStorage gets replicated onto the new character. The script is there on the new character, but the animations aren’t server sided.

Can you please provide the script used?

Yeah of course!
There are 2 scripts and I’m unsure on which one does the replicating, so I’ll just send both.

LocalScript:

local changeEvent = game.ReplicatedStorage:WaitForChild("ChangePlayerCharacter")
local characterValue = script.Parent:WaitForChild("CharacterName")
local coolTime = 1
local isCool = false

script.Parent.MouseButton1Click:Connect(function()
	wait(.5)
	if not isCool then
		isCool = true
		local characterName = characterValue.Value
		changeEvent:FireServer(characterName)
	end
end)

changeEvent.OnClientEvent:Connect(function()
	wait(coolTime)
	isCool = false
end)

ServerScript:

local BadgeService = game:GetService("BadgeService")
local changeEvent = game.ReplicatedStorage:WaitForChild("ChangePlayerCharacter")
local charsFolder = game.ReplicatedStorage:WaitForChild("Characters_")
local validateBadgeEvent = Instance.new("RemoteFunction", game.ReplicatedStorage)
validateBadgeEvent.Name = "ValidateBadgeEvent"
local cooldowns = {}

local badgeRequirements = { -- this is useless
}

local function hasBadge(player, badgeId)
	local success, result = pcall(function()
		return BadgeService:UserHasBadgeAsync(player.UserId, badgeId)
	end)

	if success then
		return result
	else
		return false
	end
end

validateBadgeEvent.OnServerInvoke = function(player, badgeId)
	local result = hasBadge(player, badgeId)
	return result
end

changeEvent.OnServerEvent:Connect(function(player, characterName)
	print("Mutator Changed! (zam was here, idk why you want to see this and idk why im still typing!!!)")

	if not charsFolder:FindFirstChild(characterName) then
		return
	end

	local badgeId = nil
	for id, name in pairs(badgeRequirements) do
		if name == characterName then
			badgeId = id
			break
		end
	end

	if not badgeId or not hasBadge(player, badgeId) then
		return
	end

	if cooldowns[player.UserId] and tick() < cooldowns[player.UserId] then
		return
	end
	cooldowns[player.UserId] = tick() + 2

	local newChar = charsFolder:FindFirstChild(characterName):Clone()
	local plrChar = player.Character

	if newChar:FindFirstChild("HumanoidRootPart") then
		newChar.PrimaryPart = newChar.HumanoidRootPart
		newChar:SetPrimaryPartCFrame(plrChar.HumanoidRootPart.CFrame)
	elseif newChar:FindFirstChild("Torso") and not newChar:FindFirstChild("HumanoidRootPart") then
		newChar.PrimaryPart = newChar.Torso
		newChar:SetPrimaryPartCFrame(plrChar.Torso.CFrame)
	end

	local animateScript = game:GetService("ReplicatedStorage"):WaitForChild("Animate")
	if animateScript then
		local animClone = animateScript:Clone()
		animClone.Parent = newChar
	end

	newChar.Name = player.Name
	player.Character = newChar

	local rootPart = newChar:FindFirstChild("HumanoidRootPart") or newChar:FindFirstChild("Torso")
	local plrRoot = plrChar:FindFirstChild("HumanoidRootPart") or plrChar:FindFirstChild("Torso")
	if rootPart and plrRoot then
		rootPart.CFrame = plrRoot.CFrame
	end

	newChar.Parent = workspace
end)

You said the Animate script is server-sided, right? Unrelated but I suggest you placing server-scripts on server storage since replicated storage is for client actions.

What can be causing this issue?

  1. You might not be loading the animation correctly / it might not be loaded to other players.
  2. Make sure you own the animation.

Can you please provide me with the animation script?

It’s just the default Animate script, I pressed the “Play” button and copied the animate script from the player!