I want to use boolValues across different scripts. For example, if I make the value true in one script, it will also be true in a different script.
I have tried printing the value when I make it true on a different script to see whether it has changed, but it doesn’t change.
I have no clue how to do this so any help is appreciated! Thanks! (also if there is a completely different way of doing this please let me know!)
2 Likes
Do script [server side script]
[also go into ‘CurrentServer’ and change boolvalue’s value manually in order to execute those scripts
example
put BoolValue into workspace
name it ‘TestOfValue’
insert 2 scripts into workspace [ not local scripts ]
name 1 = ‘S1’
name last = ‘S2’
paste this into S1:
local Value = workspace:WaitForChild("TestOfValue", 30);
Value.Changed:Connect(function(Bool)
warn("S1 Detected change at "..Value.Name..", current value: "..Value.Value);
if Bool then
Value.Value = false;
else
Value.Value = true;
end;
end);
paste this into S2
local Value = workspace:WaitForChild("TestOfValue", 30);
Value.Changed:Connect(function(Bool)
warn("S2 Detected change at "..Value.Name..", current value: "..Value.Value);
if Bool then
Value.Value = false;
else
Value.Value = true;
end;
end);
1 Like
Script1 [game.ServerScriptService]:
script.Parent.BoolValue.Value = true
Script2 [game.ServerScriptService]:
if script.Parent:WaitForChild("BoolValue").Value == true then
print("The Value Was True")
end

1 Like