Im new to scripting and I wonder if the following will change the variable number for the whole server or for just that one player that touched it.
local Var = true
local function ChangeVar(part)
if part.Parent.FindFirstChildWhichIsA("Humanoid") then Var = false end
end
script.Parent.Touched:Connect(ChangeVar)
How do you know if a variable changed for the whole server or just for a single player. Is there something in a code that will tell you that? Thank You
if u use a local like local thing1 = thing then that would only run for that script but if u used _G.var_name = something then that would be for the whole server
It will not. Scripts only have two keywords that persists through scripts of the same type, the _G
keyword, and the shared
keyword. It's not good practice to use this as you never know when those keywords will initialize a variable without polling.