Question About Events

Let’s Say you have a variable like uhh

local Number = 5

and you have an IntValue With The Same Value (5).

Then you can use GetPropertyChangedSignal() or in this case just Changed to detect if the value has changed

local Int = workspace.IntValue
Int.Changed:Connect(Function(val)
--code
end)

Is there a way to do the same (Detecting if something changed) but with variables in scripts instead like the number variable in the at the top of this post?

Thanks In Advance!

local Number1 = 5

local Number1ChangedEvent = Instance.new("BindableEvent")

Number1ChangedEvent.Event:Connect(function(newValue)
    Number1 = newValue
end)

-- to change the value of Number1, you can fire the event like this:
Number1ChangedEvent:Fire(10)

As I understood. You may be looking for modules that does this, like Fusion. Or can look on how they are made, the methods, like how the variable value detector method is made, I’m pretty sure you create functions to see if a variable is changed by calling the method / function on it.

Fusion has the watch() method to see if a variable value changes.

Maybe this is helpful in any way :grin:

where can i find “Fusion”?
or else… how can i copy the code to create my own Watch()?

Here’s Fusion Fusion (elttob.uk)
You can read about it and take a look around it, good knowledge.

I can’t really tell where to find the watch method is created, but you can look into that. I didn’t use Fusion deeply, but I used it in some cases.