I didn’t know where to put this topic, so I related it to “Feedback”.
Roblox has a few Value instances. CFrame, Int, Color, etc. But I sometimes feel it would be neat to have more. I come across properties from instances that have a ‘Value’ of a table, links, and other unordinary things. I just wanted to suggest adding more of these.
Let me go over some uses for some of these new values.
DictionaryValue:
Store Datastores more than one script can access them without obtaining a datastore twice.
Store inventory data for FPS, RPG, simulator, etc games.
ArrayValue:
Store basic data. Like players that are banned, that have joined, or that are alive in a round.
TimestampValue:
Save the time the server was created for more than one script.
VariantValue:
Sometimes, when you put a value in a BaseValue, it rejects your input. Like if you put a decimal in an int value. Or nil in any value. Variant values accept anything you put in. Quotes would be in the value to show the value you wanted a string, and not a number.
URLValue:
Store URLs you want more than one script to access. Like for the HTTPService. And now that videos are out, you could store YouTube links too.
FunctionValue:
Store global or local functions. Like math.cos(), and settings().
In all honesty, most of these can be done with what we currently have using a StringValue, tables and modules. It’s not ideal to promote BaseValues. Why? Because tables are simply better and more optimized for a game rather having an instance for a value.
You can make a module have have some functions, here some example(s).
local function toenum(enumType, str)
return Enum[enumType][str]
end
As for array and dictionary or even function you can use a ModuleScript.
As for variant, timestamp, URL you can use a string value.
People that don’t know how to script well can benefit from some of the values. Like DictionaryValues, to set default data for modules that aren’t their own. Like HD, Kohls, and Adonis Admin.
If dictionary values it would look no different than a module or it’d look like: {index={index = 2},{index = value}}
something like that which doesn’t really help and that’s just a normal table compacted into one line. What you should be suggesting is adding maybe a table visualizer which would sort in a T table and would return that.
They are just ideas… But a FunctionValue’s Value property would be scriptable only, and one script can apply a function, so other scripts can use it. Say you have a Piggy based game. You want things to happen to a player, but on the client side, and you don’t want to make alot of remotefunctions/events. A local script would pick up this function, and then run it.
Some of the values don’t need to be created because of the fact you can use loadstring to get values from a StringValue. For example:
local stringvalue = Instance.new("StringValue")
stringvalue.Value = "UDim2.new(0.5,0,0.5,0)"
-- the value would be a string, not a UDim2. to fix you would then say
local value = loadstring("return " .. stringvalue.Value)() --> UDim2
This would work, but theres a problem. What if loadstring wasn’t enabled? Loadstring allows hackers to be more aggressive with their scripts. If we had some of these new values, we wouldn’t have to write the script above.
In my opinion using BaseValue instances is bad practice due to the added overhead they provide. Just use a BindableEvent, RemoteEvent, or MolduleScript to share values depending on your needs.