Introducing the Vars+!

Hey, MrKirdid here!
I’m proudly announcing a framework especialliced for variables!

This framework allows:

  • Global Variables (Variables across multiple scripts)
  • Detecting Variable Change (link functions to when a variable is changed)

This is a WIP, however i started today, and I’m already out of ideas!!
So any suggestions would be great! I’d be happy to provide some updates to this!
This is of course a free framework, and all licenses are granted, you can do anything you want with it!

Theres a “Read Me” in the framework, but in case you don’t want to bother checking (i wouldn’t either :sweat_smile:)
Heres a short explenation/usage/showcase!

------- REQUIRE MODULE ------
local VarsPlus = require('path')

------- CREATE VALUE -------
local Coins = VarsPlus.Variable()
// Do VarsPlus.Variable("Coins") if you want a Global Variable

-------- SET VALUE -------
Coins:SetValue(100)

------- DETECT VALUE CHANGE -------
Coins:ConnectToUpdate(function(_OldValue, _NewValue)

end)

Coins:CTU(function(_OldValue, _NewValue)

end)

-------- GET VALUE ---------
local CurrentValue = Coins()

------- Get Global Value -------
Script1:
VarsPlus.Variable("CoinsVariable")

Script2:
VarsPlus.GetVariable("CoinsVariable")

Any questions/suggestions, please scream out!

Asset bellow:

8 Likes

This looks cool. I’m not huge over having to use SetValue, there are probably better ways.

Also, why not Coins.Updated(function()) instead? More consistient syntatically with normal stuff from Roblox.

2 Likes

I can find this very useful. Instead of having a folder in replicated storage with a bunch of bool and number values, I can just have this!

2 Likes

Any alternative suggestions to SetValue?

Another over engineered solution to cross script communication. Just use a shared module and setter functions

1 Like

Script communication isn’t really the main target here, the real reason i made this was pretty much souly to detect when varaibles were changed. But yeah you got a point, if you’re exclusively trying to do cross-script communication this’d be a bit overkill

A suggestion I have that might make this more useful is to allow server-to-client replication. So you can declare a variable on the server and use it on the client.

1 Like

How much does this differ from using _G or shared?

1 Like

Good idea! I’ll get that started ASAP!

Its really not a huge difference, however it’s got other features, working on a link/unlink feature rn