Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i call a _G value from a local script?

Asked by 5 years ago

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)

0
`_G` constant is not shared across the server / client boundary. EpicMetatableMoment 1444 — 5y
0
They work the same on the client and server but they're entirely different tables on the respective sides. EpicMetatableMoment 1444 — 5y
0
Don't use _G. ScriptGuider 5640 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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.

Ad

Answer this question