Loading NPCs Locally

Hey guys,

I have a system set up where NPCs are loaded from the client. Each NPC has animations that load from a server script. In this wiki page, it is said that you cannot use a local script to run animations for NPCs. The server isn’t acknowledging the server scripts in-game, however they work from studio.

Do you have any ideas of how I could load animations for NPCs that are created locally?

Thanks

They’d need to exist on the server, and then the server would need to load the animations. From that logic, it may be best to have the NPCs on the server.

Things like positioning and movement could be handled on the client, if you set it up right.

I’ve never had a problem loading client-sided animations, all the animations here;

are all exclusively client sided.

If you’re creating an object on the client, the server has no reference for it, it technically doesn’t exist.
Unless its been changed, Animations don’t have to respect filtering enabled, meaning that playing them on a controlling client will be shown on the entire server, if it exists that is.

EDIT:

Can you be a little more specific with what you’re doing here? Try creating a test server in studio and see if that yeilds a working result.

1 Like

Can confirm you can locally load animations on NPC characters just fine, no issues whatsoever. They don’t replicate to other players or the server, only the local player sees them.

4 Likes

I think you’re misinterpreting the Wiki-page.
It is suggesting to load the animations from the serverside because Roblox only replicates animations from clientside to the server if the animations belong to the character. That means if you load animations for a serverside-created object from the client it will not replicate to the other clients, unlike your player animations.

You may load your NPC animations from the clientside if you only plan on the local player to be see it.

2 Likes

Okay! I seem to have misunderstood. Thank you for your help everyone :slight_smile:

1 Like

Maybe make the animation Script into a ModuleScript (via cut and paste), then add “return true” to the end of that ModuleScript so it doesn’t error. You could then require that animation script from something running on the client when the NPC is created so so it runs locally. I’ve never used Roblox animations so I’m not sure if this will work.