local function onValueChanged(new_value)
task.spawn(function()
--- do things here
)
end
?
I’m asking because this is what I’ve always done since using this module, I’d like some insight into your own workflow for this kind of thing if that’s okay
What @Riesegarder said. Also make sure to cleanup the previous connection when connecting the same one again. Otherwise you’ll end up with an extra connection every respawn.
Easiest solution would be to disable ‘ResetOnSpawn’ on the screengui. If that’s possible for your usecase.
The fact that you say this just proves how inconvenient this is in its current form. It’s such a simple fix too, with such a dangerous result if not.
What I did was just go into the module, CTRL + F, and change every (not commented) listener( to task.spawn(listener,. If you put spaces in between your commas be sure to add a space at the end of task.spawn(listener,.
Hey, is there a canonical, StreamingEnabled-compatible way to associate an instance with a replica? I’ve been assigning a unique ID to relevant instances through Roblox’s attribute system as a workaround, but it feels a little hacky.
Edit: Just realized replicas already have their own unique IDs I could have been using.
Just coming back to this. I realized yeah, why isn’t it the default behavior? I’ve started doing what you’re doing and it does simplify a lot of the things I end up doing.
Just coming back to this. I realized yeah, why isn’t it the default behavior? I’ve started doing what you’re doing and it does simplify a lot of the things I end up doing.
^ idk why this wasn’t posted as a reply to this message
In a 30 server size game, is getting all player replicas on the client okay? Until recently I only handled the local players profile replica, but I need to grab some data from other players’ replicas. Would this dramatically increase network usage, or would this be alright?
I’m off course not the creator of this module, but I think ReplicaService is supposed to be reliable. So using unreliable events wouldn’t make much sense.
For example: the use case of replicating profile service data. You want to make sure the client receives their latest data. This isn’t what unreliable events are for.
Are you planning on adding more methods to the ReplicaController and ReplicaService to incorporate the new UnreliableRemoteEvents? Methods like FireClientUnreliable, FireAllClientsUnreliable, etc… would be very useful to have.
-- ( `LocalScript` ReplicaTest.client.lua)
local ReplicaController = require(game.ReplicatedStorage.ReplicaController)
ReplicaController.ReplicaOfClassCreated("onserver", function(replica)
print("TestReplica received! Value:", replica.Data.Value)
replica:FireServer()
end)
ReplicaController.RequestData() -- This function should only be called once
-- in the entire codebase! Read the documentation for more info.
Question loleris, how would I go about wrapping profile.Data in serverscriptservice with a replica so that I can call/view it’s data at any time on the client-side?
Wrap it in a “Data Service” or DataService Class that sets data to the ProfileStore & sets the data to a replica. You’ll require that class in every script where you feel it’s needed.