How would I share a variable with multiple scripts

Hi I have hit one of my scripting barriers and would like to know if somebody knows how to
share a variable with multiple scripts
and all these scripts can change this variable to true or false
this variable will be a debounce by the way
I need this because
I have a stamina script and a sword(Tool)
when you use the sword it slows you down but to bypass this all you have to do is click shift because of the stamina script so that’s why I need to share a variable between multiple scripts

I appreciate any help I can get

I remember, use _G

it’s for sharing things across scripts,

like this

-- Script1
_G.Yes = true

and another script

-- Script2
if _G.Yes == true then
    print(_G.Yes)
end

-- Expected output: true

I’m not sure, but I think this is the option

6 Likes

Just add a BooleanValue named “Debounce” inside the tool.

--script 1
script.Parent.Debounce.Value = true
--script 2
if script.Parent.Debounce.Value == true then
    print("debounce is true")
    --might do other stuff here
end

does this work for client to server scripts?