i want to call _G.H = (mouse.hit) from a local script in a regular script by using
print (Vector3.new(_G.H.X,_G.H.Y,_G.H.Z)) but it gives me the error message ServerScriptService.ChangeScript:8: attempt to index field 'H' (a nil value)
COMMUNITY QUESTION
how do i call a _G value from a local script?
1 answer
It is impossible to do so. A RemoteEvent, much less a RemoteFunction, won't help you either. Both RemoteEvents and RemoteFunctions replicate objects across the server/client boundary, and because _G can't be replicated across that boundary, you cannot transfer it to a local script from a server (normal) script. You can use _G separately on the client (it behaves the same way it behaves on the server), but you can't transfer it unless you use BindableEvents or BindableFunctions between server or local scripts.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
_Gconstant is not shared across the server / client boundary.They work the same on the client and server but they're entirely different tables on the respective sides.
Don't use _G.