Have you ever done this or has anyone ever done this before?
Try updating all of the string values and number values before the boolvalue then update the bool value like this in the server script.
values (both string and number) = value you want here
boolValue = true
boolValue = false
Something along the lines of that.
Then in the client check if the bool value has changed. If it has check all of its children for changes.
Then try to make a dictionary using all of the strings and values.
Hope this helps!
I have before. The idea is that you turn these CFrames, Color3s, etc into storable data, like tables, strings, and integers.
Could you send the code or the module you use?
Were you updating the object value every heartbeat or only when data was beinng changed?
I donât have a module you can use, I can show you an example of some serialized data though
local serializedData = { dataType = "Color3", data={r=1,g=0,b=0}}
Personally, I would be more comfortable with only changing the data when itâs changed
No Iâm not talking about serializing data im talking about the http functions you would use onto the string obect value
That would look something like this then.
-- Server
local dict = {
-- stuff
}
stringVal.Value = HttpService:JSONEncode(dict)
-- Client
stringVal.Changed:Connect(function(jsonDict)
local dict = HttpService:JSONDecode(jsonDict)
-- do stuff
end)
To bypass the 200,000 limit which I dont think ill reach but letâs say for example I have like a shop dictionary, a weapon info dictionary and letâs just say a playerâs inventory dictionary
Could I just create different string value objects, for each dictionary im looking to send over to the client when I need too?
Thanks for this I managed to create a little module for just this!
local module = {}
local RunService = game:GetService("RunService")
local Httpservice = game:GetService("HttpService")
module.Object = script.Object
if RunService:IsServer() then
module.Global = {
Data = {},
TempStuff = {}
}
function module.UpdateObjectValue()
module.Object.Value = Httpservice:JSONEncode(module.Global)
end
end
function module.Retrieve()
if module.Object.Value ~= "" then
return Httpservice:JSONDecode(module.Object.Value)
else
repeat task.wait() until module.Object.Value ~= ""
return Httpservice:JSONDecode(module.Object.Value)
end
end
return module
A disclaimer:
If youâre working with truly massive dictionaries that are kilobytes in size, do not set the StringValue value rapidly with a humongous string. This will completely destroy the clientâs experience due to the massive amount of data being transferred.
You should only send the massive string a single time when the client joins the game so that the client can get its copy. Afterwards, any changes made to the dictionary server-side should be replicated via a RemoteEvent with the only information being the key changed (use an array if this is nested) and the new value of the key.
Yeah I have no plan on making massive dictionaries or anything like that, so this seems like a solid way for me to seamless send values over too the client alowing them to read it almost instantly, thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.