So I have a variable, _G.have. How do I make this global variable appear in my StarterGui code?? Code in starter:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.Button2Down:Connect(function() print(_G.have) if _G.have == true then player.Character.Weld:Destroy() --ignore these _G.have = false end end)
It just prints nil, can someone please tell me how to make global variables in starterGui???
Hi there, before I begin I want to apologize for my minimal brain activity, it's 02:27 here, anyways,
_G is what's known as a global table, what matters is that it's not very global the way we use it, it depends on the lua state and other stuff, all you need to know is:
_G does not transfer between scripts with different context values, and in your case, the main problem, is that _G does not transfer between the server and client, you cannot use it for server-client variable transferring.