Russian:
https://devforum.roblox.com/t/fastvalueservice/700921
Repositories:
RojoFastValuesAPI
https://github.com/MFD-gh/RojoFastValuesAPI
Created by @AleksejGrasnich @IvanGregrovnich and @0x6e7367
What is a FastValue?
A FastValue is a Value, when changed, will apply to every server without requiring a server shutdown.
FastFlag
A FastFlag is a Boolean
. This is mostly used for BetaFeatures that you have but don’t want to be enabled until you finish them
FastString
A FastString is a String
. This will mostly be used as a Code for something, i.e. a promotional code, or an AES Key
FastNumber
A FastNumber is an Int32, Int64, Float or Double
. This will mostly be used for Versions.
FastDictionary (or FastTable)
A FastDictionary is a List, Table, Array or Dictionary etc.
. This will be used for setting multiple values that you want to have in only one constant.
Download.
To use FastValueService (Server):
local ServerScriptService = game:GetService("ServerScriptService");
local FastValueServiceContainer = ServerScriptService:WaitForChild("FastValueService");
local FastValueService = require(FastValueServiceContainer:WaitForChild("FastValueService"));
require(ServerScriptService.FastValueService:WaitForChild("FastValueServiceListenerStarter"))();
-- Create a FastFlag called TestFlag with a value of True:
FastValueService:DefineFastFlag("TestFlag", true);
-- Create a FastFlag called TestStringFlag with a string value:
FastValueService:DefineFastFlag("TestStringFlag", "This will error");
-- Will return the error: "FastFlag is not a boolean, consider not using "This will error" (String)"
-- Get a the FastFlag we just created:
FastValueService:GetFastFlag("TestFlag");
-- Will return: "true"
-- Get a FastFlag that doesn't exist:
FastValueService:GetFastFlag("TestFlagThatDoesNotExist");
-- Will return the error: "FastFlag not found. Consider doing a DefineFastFlag("TestFlagThatDoesNotExist", true or false)."
-- To see the rest of the values, scroll down to the API Reference.
To use FastValueService (Client):
local ReplicatedStorage = game:GetService("ReplicatedStorage");
local GetFastValue = ReplicatedStorage:WaitForChild("GetFastValue");
-- To get a FasfValue (FastFlag in this example):
local FastFlag = GetFastValue:InvokeServer("GET", "FASTFLAG", "TestFlag");
-- To create a FastValue (FastString in this example):
local FastString = GetFastValue:InvokeServer("POST", "FASTSTRING", "TestFlag2", "String");
When you download the File from above. It doesn’t matter where it is put (As long as it isn’t anywhere on the client), and it will setup everything itself:
API Docs:
GET
GetFastFlag
bool GetFastFlag(string FlagName)
Parameter(s)
Name | Type | Default | Description |
---|---|---|---|
FlagName | String |
nil |
The name of the FFlag you are attempting to access. If nil then it will error |
Return
Return | Summary |
---|---|
Boolean | True or false depending on if it’s enabled |
GetFastString
string GetFastString(string FlagName)
Parameter(s)
Name | Type | Default | Description |
---|---|---|---|
FlagName | String |
nil |
The name of the FastString you are attempting to access. If nil then it will error. |
Return
Return | Summary |
---|---|
String | Whatever value was set |
GetFastNumber
int, float, double GetFastNumber(string FlagName)
Parameter(s)
Name | Type | Default | Description |
---|---|---|---|
FlagName | String |
nil |
The name of the FastNumber you are attempting to access. If nil then it will error |
Return
Return | Summary |
---|---|
Int32, Int64, Float, Double | Will be atleast 0+ or 0- |
POST
DefineFastFlag
void DefineFastFlag(string FlagName, bool Value)
Parameter(s)
Name | Type | Default | Description |
---|---|---|---|
FlagName | String |
nil |
The name of the FFlag you are attempting to create. If nil then it will error |
Value | Boolean | false | Value, can either be true or false |
Return
Return | Summary |
---|---|
Void, Nil or None | Will return nothing |
DefineFastString
void DefineFastString(string FlagName, string Value)
Parameter(s)
Name | Type | Default | Description |
---|---|---|---|
FlagName | String |
`` | The name of the FastString you are attempting to create. If nil then it will error |
Value | string | “” | Value, can be empty also, but has to be a string |
Return
Return | Summary |
---|---|
Void, Nil or None | Will return nothing |
DefineFastNumber
void DefineFastNumber(string FlagName, int float double Value)
Parameter(s)
Name | Type | Default | Description |
---|---|---|---|
FlagName | String |
nil |
The name of the FNumber you are attempting to create. If nil then it will error |
Value | Int32, Int64, Float, Double | 0 | Value, can either be an Int32, Int64, Float or Double |
Return
Return | Summary |
---|---|
Void, Nil or None | Returns nothing |
UPCOMING FEATURES
DynamicFlagLibrary
Ignore (Source)
FastValueServiceSetupRunner (ClassName: Script)
--!nocheck
-- // FileName: FastValueServiceSetupRunner.lua
-- // Version: 1.0
-- // Written By: Aleksej Grasnich
-- // Description: Will setup everything in order
-- // TODO:
--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local this = script
local ToBeReplicated = this:WaitForChild("FastValueService")
local GetFastValue = Instance.new("RemoteFunction", ReplicatedStorage)
GetFastValue.Name = "GetFastValue"
local FastValueServiceInfo = Instance.new("Folder", ToBeReplicated)
FastValueServiceInfo.Name = "Info"
local Link = Instance.new("StringValue", ToBeReplicated)
Link.Name = "https://devforum.roblox.com/t/fastvalueservice/"
local Credit = Instance.new("StringValue", FastValueServiceInfo)
Credit.Name = "Credit"
Credit.Value = "Aleksej Nikolaevich Grasnich, Nikita Nikolaevich Pedko, Ivan Ivanovich Gregrovnich"
local LastUpdateDate = Instance.new("StringValue", FastValueServiceInfo)
LastUpdateDate.Name = "LastUpdate"
LastUpdateDate.Value = "25/07/2020 05:04.123 UTC+9"
local Version = Instance.new("IntValue", FastValueServiceInfo)
Version.Name = "Version"
Version.Value = 4
local DevforumLink = Instance.new("StringValue", FastValueServiceInfo)
DevforumLink.Name = "DevforumLink"
DevforumLink.Value = "https://devforum.roblox.com/t/fastvalueservice/"
ToBeReplicated.Parent = ServerScriptService
script:Destroy()
FastValueService (ClassName: ModuleScript)
--!nocheck
-- // FileName: FastValueService.lua
-- // Version: 2.5
-- // Written By: Aleksej Grasnich and Nikita Pedko
-- // Description: Main handler when using FastValues
-- // TODO:
-- Add support for DynamicFlags
-------------- SERVICES --------------
local DataStoreService = game:GetService("DataStoreService")
local HttpService = game:GetService("HttpService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-------------- DATASTORES --------------
local FastFlagDataStore = DataStoreService:GetDataStore("FlagStore", "FastFlags")
local FastStringDataStore = DataStoreService:GetDataStore("FlagStore", "FastStrings")
local FastNumberDataStore = DataStoreService:GetDataStore("FlagStore", "FastNumbers")
local FastDictionaryDataStore = DataStoreService:GetDataStore("FlagStore", "FastDictionarys")
-------------- CONSTANTS --------------
local FlagFunctions = {}
-------------- FLAGFUNCTIONS --------------
-- STATIC FLAGS
-- FASTFLAG
-- GET
function FlagFunctions:GetFastFlag(FastFlag)
if typeof(FastFlag) ~= "string" then
return error("FastFlag searcher root must be a string!")
end
local FastFlagReturnedData = FastFlagDataStore:GetAsync(FastFlag)
if FastFlagReturnedData == nil then
return error("FastFlag not found. Consider doing a DefineFastFlag(\""..FastFlag.."\", true or false).")
end
return FastFlagReturnedData
end
-- PUBLISH
function FlagFunctions:DefineFastFlag(Name, Value)
if typeof(Value) ~= "boolean" then
return error("FastFlag is not a boolean, consider not using "..Value.." ("..typeof(Value)..")")
end
FastFlagDataStore:SetAsync(Name, Value)
end
-- FASTSTRING
-- GET
function FlagFunctions:GetFastString(FastString)
if typeof(FastString) ~= "string" then
return error("FastString searcher root must be a string!")
end
local FastStringReturnedData = FastStringDataStore:GetAsync(FastString)
if FastStringReturnedData == nil then
return error("FastString not found. Consider doing a DefineFastString(\""..FastString.."\", \" \").")
end
return FastStringReturnedData
end
-- PUBLISH
function FlagFunctions:DefineFastString(Name, Value)
if typeof(Value) ~= "string" then
return error("FastString is not a string, consider not using "..Value.." ("..typeof(Value)..")")
end
FastStringDataStore:SetAsync(Name, Value)
end
-- FASTNUMBER
-- GET
function FlagFunctions:GetFastNumber(FastNumber)
if typeof(FastNumber) ~= "string" then
return error("FastNumber searcher root must be a string!")
end
local FastNumberReturnedData = FastNumberDataStore:GetAsync(FastNumber)
if FastNumberReturnedData == nil then
return error("FastNumber not found. Consider doing a DefineFastNumber(\""..FastNumber.."\", 0).")
end
return FastNumberReturnedData
end
-- PUBLISH
function FlagFunctions:DefineFastNumber(Name, Value)
if typeof(Value) ~= "number" then
return error("FastNumber is not a number, consider not using "..Value.." ("..typeof(Value)..")")
end
FastNumberDataStore:SetAsync(Name, Value)
end
-- FASTDICTIONARY
-- GET
function FlagFunctions:GetFastDictionary(FastDictionary, ShowValues)
if typeof(FastDictionary) ~= "string" then
return error("FastDictionary searcher root must be a string!")
end
local FastDictionaryReturnedData = FastDictionaryDataStore:GetAsync(FastDictionary)
if FastDictionaryReturnedData == nil then
return error("FastDictionary not found. Consider doing a DefineFastDictionary(\""..FastDictionary.."\", {}).")
end
local DecodedFastDictionaryReturnedData = HttpService:JSONDecode(FastDictionaryReturnedData)
if ShowValues then
warn("Showing values of "..FastDictionary)
for Key, Value in pairs(DecodedFastDictionaryReturnedData) do
print(Key,"|",Value,"|",typeof(Value))
end
return FastDictionaryReturnedData
end
return FastDictionaryReturnedData
end
-- PUBLISH
function FlagFunctions:DefineFastDictionary(Name, Value, Sort)
if typeof(Value) ~= "table" then
return error("FastDictionary is not a table, consider not using "..tostring(Value).." ("..typeof(Value)..")")
end
if Sort then
table.sort(Value)
end
FastDictionaryDataStore:SetAsync(Name, HttpService:JSONEncode(Value))
end
return FlagFunctions
FastValueServiceListener (ClassName: ModuleScript)
local FastValueService = require(script.Parent)
return function(fromPlayer, Cast, Type, fastValue, ValueToSet)
if Type:lower() == "fastflag" then
if Cast:lower() == "get" then
return FastValueService:GetFastFlag(fastValue)
elseif Cast:lower() == "post" then
if type(ValueToSet) ~= "boolean" then
return error("Type set is not valid")
else
return FastValueService:DefineFastFlag(fastValue, ValueToSet)
end
else
return error("Cast is not valid!")
end
elseif Type:lower() == "faststring" then
if Cast:lower() == "get" then
return FastValueService:GetFastString(fastValue)
elseif Cast:lower() == "post" then
if type(ValueToSet) ~= "string" then
return error("Type set is not valid")
else
return FastValueService:DefineFastString(fastValue, ValueToSet)
end
else
return error("Cast is not valid")
end
elseif Type:lower() == "fastnumber" then
if Cast:lower() == "get" then
return FastValueService:GetFastNumber(fastValue)
elseif Cast:lower() == "post" then
if type(ValueToSet) ~= "number" then
return error("Type set is not valid")
else
return FastValueService:DefineFastNumber(fastValue, ValueToSet)
end
else
return error("Cast is not valid")
end
else
return error(Type.." is not a valid FastValue type.")
end
end
FastValueServiceListenerStarter (ClassName: ModuleScript)
-- I feel as if this is useless, will most likely be deprecated in the future
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FastValueServiceListenerModule = require(script.Parent:WaitForChild("FastValueServiceListener"))
return function()
ReplicatedStorage:WaitForChild("GetFastValue").OnServerInvoke = FastValueServiceListenerModule
end