Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I'm a bit confused about how :FireClient() works?

Just a quick question:

I want to script an NPC to move towards the player when the player touches a part. However, I would like ONLY the player to be able to see the NPC move. Because computing paths can only be done in normal script/server-sided scripts (Correct me if i'm wrong), do i need to use a remote event, using :FireClient() ?

I'm a bit confused how :FireClient() works. Do they make it so that only the player can see what's happening? Should i use it in my NPC code? Or is there a better way?

Thanks for your time and help! All help is appreciated!

1 answer

✓ Accepted answer

FireClient() fires an event to a specified client, and any code within that event's function is run on the client when the event fires. Making an NPC move on the client will only be seen by the client; the server will not read any movement the NPC makes.

In terms of pathfinding, I believe that this is not possible on the client. If you really wanted to make an NPC move only on one client, you could spawn parts at the path waypoints and make the NPC move to those parts using their Humanoid's MoveTo method.

1 comment

0

Br u h

This discussion is preserved as it was. New answers, comments, and votes are closed.