How to make animate script replicate on all clients?

I have multiple characters using different Animate scripts (the one provided for default R6 characters) however whenever I clone the character and enable the animate script, it doesn’t work on the client nor for other players.

server script

RequestLoadEvent.Event:Connect(function(Player: Player, Name: string, Pivot: CFrame?)
	local Character = HunterCharacters:FindFirstChild(Name) :: Model
	if not Character then return end
	
	Character = Character:Clone()
	Character:PivotTo(Pivot)
	Character.Parent = workspace
	
	Character.Name = Players:GetNameFromUserIdAsync(Player.UserId)
	Player.Character = Character
	
	for _, v: LocalScript in Character:GetChildren() do
		if v:IsA("LocalScript") then
			v.Enabled = true
		end
	end
end)

and whenever I enable them on the client, only the client that wields the character sees the animations

localscripts only work in a character when the character is assigned to a player via the character property. I assume you’re cloning the localscripts and parenting them to the characters but they arent assigned to any player.


you can see in the above image that i can clone a localscript to my character and it’ll work. but when i clone it to a dummy it doesnt work
image
now, in the above image i set my character to the same dummy and cloned the script again. this time it works

not sure how useful you’ll find this for your issue, but here is a list of datamodels where localscripts will execute

also, i noticed you’re enabling the localscripts after they’re cloned. whether a localscript is enabled or disabled does not change when cloning them

i’m not sure on what you mean by this, but incase my advice didnt help could you elaborate on this?

1 Like

the scripts are inside the character model that is grabbed, which then the model is cloned. I then set the player’s character to that of the character model, and finally search it for local scripts (all of which are disabled) and enable them.

usually every character in-game has the local script called “Animate” inside of their character. this script is usually enabled by default in every player character in the game

could you try setting the character to the player before parenting the character to the workspace?

this does work for the client that has their character set, however for other players the animation is still not replicated

I still need help for either other ways to do this or just a fix in general that does not include just turning the script into a server sided one

would it be better just to make my own animation script for them instead of using ROBLOX’s?

Hey! I looked at ya script the way you’re spawning and enabling the character works! BUT there are a FEW things to watch out for:


  1. Local Scripts only run for the local player
    Even if you do enable them on the server, Local Scripts will ONLY run for the player who owns that character. For other players to see animations or effects, you need RemoteEvents to tell their clients what to do.

  1. Setting Player.Character manually
    It works, but be careful some systems (like Animate or HumanoidState) may behave unexpectedly if you replace the character at runtime. Always wait a frame after setting Player.Character before doing actions that rely on Humanoid events.

  1. PivotTo placement
    Make sure Pivot is valid; otherwise, the character may spawn inside parts or in unexpected positions. A safe pattern is:

Character:PivotTo(Pivot or CFrame.new(0,5,0))

Docs to check:

https://create.roblox.com/docs/scripting/players/characters
https://create.roblox.com/docs/scripting/animation/animation
https://create.roblox.com/docs/guides/remote-events-and-functions


yeah my problem with this though is that naturally players will spawn with an animate script, and it works perfectly fine, because usually animations that are played by the client are replicated to other players

A problem with the pivot was never even mentioned in the post, so I’m confused why you are even bringing it up?

I assume this reply was GPT now that I look at the links lol

the problem was that my humanoid was missing an Animator instance

The links were provided by GPT, thought it would help you get a clearer understanding didn’t know it didn’t work lmao.

About the pivot issue, I had a similar issue related to this when making a horror game hence why I mentioned it.

Glad you fixed, sorry for the inconvenience.