Can anyone help me to understand why is it that when I use a LocalScript inside StarterPlayerScripts to play an animation on the player’s character, it works and it is replicated to all other players in the game.
But when I use the same LocalScript to play an animation on a dummy in the workspace, it is NOT replicated to other players in the game. I would need to fire a remote event to the server for a script in the server to play the animation.
I’m just confused because isn’t the player’s character and the dummy, both located on the server side in the workspace and should work the same?
This doesn’t answer the question as to why does the animation work on the character but not on the dummy. They are both at the same location in the workspace.
The LocalScript is inside StarterPlayerScripts, so in the game it is parented to the player’s PlayerScripts.
Basically we have a LocalScript accessing 2 different objects in the workspace, but one works and one doesn’t.
The Solution is Literally in @WolfieCodesMent 's Image, It works on the Players model (model is referring to their Character), The Dummy is not the Player’s Character, nor is it a Player at all, LocalScripts will not run there because of that.
If you want to Run a LocalScript in the workspace:
First of “server-side workspace”? Never heard of it. Second, if you want to play an animation on a dummy you’ll have to move that script out of workspace since LocalScripts won’t run in workspace.
Also StarterPlayerScripts will replicate all scripts within it to Players joining the game which is why it won’t replicate to your dummy; the object already exists.
Just change the LocalScript to a ServerScript and change the RunContext to Client and you should be good!
I think I see what you mean. So basically the LocalScript can parented to the player’s PlayerScripts, but it will be able to change any of those 5 items such as the Backpack, Character model, and PlayerGui?
Yes that’s how I understand it when I look at @WolfieCodesMent image. But my question is how come my LocalScript in the StarterPlayerScripts works on the player’s character but not on the dummy, both of which are inside the workspace. From reading all the comments, it sounded like what they are trying to say is that the LocalScript can be inside any of those 5 items in the image, and it can change the player’s Backpack, Character model, and PlayerGui. Am I understanding them correctly?
Ok so… " It works on the Players model" and this is why the LocalScript is able to play the animation on the player’s character.
But how do you explain it, when I use the same LocalScript to try to change the MeshPart of the character, it does NOT work.
On the other hand… When my LocalScript fires a remote event to the server side and a Script inside the ServerScriptService catches it and changes the MeshPart of the character, everything works fine.
Why isn’t the LocalScript able to change the MeshPart of the character (which is the player’s model)?