#Does Roblox enforce that LocalScripts in StarterCharacterScripts only run for my LocalPlayer?

1 messages · Page 1 of 1 (latest)

merry creek
#

I have a very fundamental question..
If i put a sprint script in StarterCharacterScripts It gets replicated into every character.

Supposing im player A. From my POV this script gets replicated into my character model AND ALSO Player B's character model.
So then when I press shift so print, how come only my speed changes?

I tested by adding a print("I am working") into the first line of the script.
This line only runs once. I would expect it to run as many times as there are players right?? Everytime a new player joins, and the script is added to their character, this print statement should run right? in theory??

Since from my POV (player A) this script exists under each player character model?

halcyon folio
# merry creek I have a very fundamental question.. If i put a sprint script in `StarterCharact...

It basically comes down to Execution Context.

Even though that script is inside every character, a LocalScript only actually runs for the person who owns that character. So your computer sees the script inside Player B, but it just ignores it because you aren't Player B.

That is why you only see the print once your computer only executes your version of the script. Player B sees the print on there screen too, but you can't see their output log!

Also, you have 'Network Ownership' over your own character, which is why you can change your own speed but the script doesn't try to touch anyone elses speed.

merry creek
#

This is made even more confusing by the fact that a normal script with the runcontext set to client, DOES not do this.
It absolutely runs for every instance, regardless if it is in another player's character

subtle fiber
#

Like what did u expect bruh s local script can only access ur client.

halcyon folio
merry creek
subtle fiber
#

Yeah cuz local scripts only see the local client and also the server somewhat with remote functions

soft craneBOT
#

studio** You are now Level 5! **studio

halcyon folio
#

local script dose send removeevent to server

#

and server do what that remote event want to do from the local script