Replica Service Using multiple scripts

I am having trouble trying to figure out how to get replicates from other server scripts

		local replicate = Replica.New({
			Token = Replica.Token("ProfileData"),
			Data = Manager.Profiles[player].Data,
			Replication = player
		})
		replicate:Replicate()
		task.spawn(function()
			while task.wait(1) do
				if profile == nil then
					break
				end
				replicate:Set({"Diamonds"}, Manager.Profiles[player].Data.Diamonds)
			end
		end)

basically i only want to use Set when its required not just doing it every 1 second
and i want to be able to do it inside multiple scripts

1 Like

Why can’t you create your own system, Replica is made up from remote events, as long as you organize remote events and check if code can be runned or not is simple

This piece of code stops 90% of exploits you’ll encounter with remote events:

local function onServerEvent(Player: Player)
    if os.clock() - Debounces[Player] <= Cooldown then
        return
    end

    --/ Code
end

If you create&destroy player cooldown in your debounces table, this is best solution and you don’t need to worry about exploits or anything like that

can you explain how to do it with replica service?

you can just use replica.RequestData() on the client

Replica service is custom made service, so i can’t help much cuz i don’t use it, but really it’s always better to use your own tools, so you can remove unnecesary stuff and also learn how they work, instead of relying on someone else’s work

1 Like

well that’s an opinion, I believe that’s like reinventing the wheel. it’s not required and will take a while for you to do.

Reinventing the wheel is when you make identical copy of something, otherwise it’s very effective to make your own systems, as you gain more control over them and can make them a lot better

Of course, if you can’t do it then community modules are great, but replication is very easy and it can benefit you