Check out example codes for "what do you need local sccripts for". It will help you in understanding the concepts better.

Code Example 1

A LocalScript is a Lua source container that runs Lua code on a client connected to a Roblox server. They are used to access client-only objects, such as the player's Camera . For code run through LocalScripts, the LocalPlayer property of the Players service will return the player whose client is running the script.

Learn ReactJs, React Native from akashmittal.com