Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Does variables change for the whole server?

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

2 answers

✓ Accepted answer

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

2 comments

0

insert your var name into var_name btw

0

please click answer if this helped!

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.