Explain
I have 2 LOCAL SCRIPTS, both scripts have the SAME code. What I want to happen is the following:
Use the two values Debo and CurTab almost like global variables that can be accessed from any other local script. Debo is a BOOL being short for debounce, will be set to true when I want to activate a “cooldown”. CurTab is a STRING value, and the value of it is supposed to change to whichever button I clicked on.
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.5)
local GoalOpen = {BackgroundColor3 = Color3.fromRGB(238, 238, 238), ImageColor3 = Color3.fromRGB(56, 56, 56)}
local GoalClose = {BackgroundColor3 = Color3.fromRGB(56, 56, 56), ImageColor3 = Color3.fromRGB(238, 238, 238)}
local CurTab = script.Parent.Parent.CurrentTab.Value
local Debo = script.Parent.Parent.Debounce.Value
local function TweenButton(inst, goal)
local CreateTween = TweenService:Create(inst, tweenInfo, goal)
CreateTween:Play()
end
script.Parent.Activated:Connect(function()
print("--------------------")
print("Start:"..CurTab)
if not Debo and CurTab == "" then
Debo = true
CurTab = script.Parent.Name
print("Selecting")
TweenButton(script.Parent, GoalOpen)
wait(1)
Debo = false
elseif not Debo and CurTab == script.Parent.Name then
Debo = true
CurTab = ""
print("Unselecting")
TweenButton(script.Parent, GoalClose)
wait(1)
Debo = false
elseif not Debo and CurTab ~= script.Parent.Name and CurTab ~= "" then
Debo = true
CurTab = script.Parent.Name
print("Desellecting others")
for i, v in pairs(script.Parent.Parent) do
if v.Name == CurTab then
TweenButton(v, GoalClose)
end
end
TweenButton(script.Parent, GoalOpen)
wait(1)
Debo = false
end
print("End:"..CurTab)
print("--------------------")
end)
Here is what happends when I click the HOME button

Here is what happends when I click the LOCAL button WHILE the HOME button is selected

Conclusion
So overall, the two local scripts are able to read and write to the value but when I try to read it from another local script, it doesn’t read a value, even if one script does read a value.
