How do I read a variables boolean across different scripts?

Hello. I’m currently programming a small side game and I’m stuck on a little issue. I want to read the boolean of my variables in one local script, and have them written in another script.

Is this possible? How would I go about doing this? For example:

My local script in starterplayerscripts -

local example = true

My script in serverscriptservice -

if example then
    print("Yes")

What about remote events?This text will be blurred

How would I use those? Would they still allow me to do things locally and not server-sided?

Look at tutorials or Roblox docs to learn about remote events and function, bindable events and functions

You can use the _G declaration to use variables across scripts like so:

Script A:

-- Declaration on script A
_G.myvalue = true

Script B:

-- Use that variable we set earlier
if _G.myvalue then
   print("Yes")
end

Note that it only works on the same-type scripts (Localscript to Localscript, for example)