For using ProfileService, how could I replicate info to the client without firing many remotes/functions to manage GUIs that display player data?
I do not want to use ReplicaService due to the requirement of many modules.
For using ProfileService, how could I replicate info to the client without firing many remotes/functions to manage GUIs that display player data?
I do not want to use ReplicaService due to the requirement of many modules.
You could use NumberValues or StringValues and such, but I’d honestly recommend ReplicaService. I know you don’t wanna use it, but using it myself it’s been incredible. (Also, I have no clue about the implications and usage of Attributes but maybe?? Finally I believe _G replicates.)
I would use ReplicaService, but it just annoys me a bit that there are such many modules that it needs me to have inside my game.
I wanna have some sort of system where a localscript could listen to a change in data then replicate on screen, ie changing a number to whatever the player’s coin stat is.
Yeah, the other methods I provided should work for that, just toy around with them for whatever works best. I don’t know too much about Attributes though, so keep that in mind.
I did some reading on ReplicaService, and how could I implement it into my game?
How I use the list of data inside of my game I keep a sub-module underneath of the main data module, which the above script can call for data template. So the only option I’ve thought of so far include doing a loop for every stat (which sounds REALLY bad for a high player server). Any ideas on how I could fully automate this without needing heavy performance debuffs?
Or I am thinking about this wrong? I am very confused.
Attributes would be great for this. You could do something like this:
-- Server
Players.PlayerAdded:Connect(function (player)
local data = Instance.new("Configuration")
data.Name = "PlayerInfo"
data.Parent = player
end)
local function setValue(player, key, value)
player.PlayerInfo:SetAttribute(key, value)
end
-- Client
local playerInfo = Players.LocalPlayer:WaitForChild("PlayerInfo")
playerInfo.AttributeChanged:Connect(function (key)
local value = playerInfo:GetAttribute(key)
-- do something with key and value
-- if key == "Money" then ...
end)
How did you go about using ReplicaService inside your game?
I followed the information off the wiki for it; Replicate your states with ReplicaService! (Networking system)
Implementation really just depends on your game, but seriously read everything and what each thing does. As some ways I tried using things, ended up being wrong.