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
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?
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
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:
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.
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.
PivotTo placement
Make sure Pivot is valid; otherwise, the character may spawn inside parts or in unexpected positions. A safe pattern is:
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