Player Data [ASK]

Question
So I have a custom Player List UI, and stats with name ‘Stats’ (not leaderstats) with IntValue name Kill in every Player. Is it gonna automatically change the text in my Player List that has every players (same like default Player List) with Player Kill Values in every player frame, if I change the kill values the value using server script? Or if not, how to achieve that?

Thank you.

So you will want to get the kills from the leaderboard value if there is a leadboard if not then the server will have to send them via a remote

Not quite.

On the client, you could just setup functions that is connected to the replicated data for each player, for when every players data is changed. It will have the same result to some extend.

Yes but i want the other players also able to see changes on other players stats, let’s say A and B, I want A to see B values change too when I change player B stats with server script

Well… that is exactly what connected functions to the replicated data means.

Here’s a quick example.

-- ClientScript

local Players = game:GetService("Players")

local function OnPlayerAdded(Player)

local PlayerData = Player:WaitForChild("PlayerData")
local Coins = PlayerData:WaitForChild("Coins")

Coins:GetPropertyChangedSignal("Value"):Connect(function()
TEXTLABEL_TO_SHOW_A_PLAYERS_COINS.Text = Coins.Value
end)

end

Players.PlayerAdded:Connect(function(Player)
OnPlayerAdded(Player)
end

for _, Player in pairs(Players:GetPlayers()) do
OnPlayerAdded(Player)
end

You don’t have to disconnect anything, since a player’s coins & playerdata is removed on the server when they leave.

So I don’t need to use remote event?

You can, but I don’t see a reason to, when you can handle all of the client stuff on the client, without sending signals from the server through a remote.

You see, remote’s are used to communicate between the server & client (and vice versa). But you don’t have to send this kind of data or remote, since the data is already present, through the replicated values under the Players.

Remotes and replicated objects have the same kind of usage, only difference being is that values are easy to exploit and are more limited in terms of use and also less reliable in terms of the need to use prop change event

Hi!

I wouldn’t say that ValueObjects are easy to exploit, since it’s a one-way door. You won’t change any Value of an ValueObject from the client. And for this use-case, you can without doubt use ValueObjects instead of remoteevents.

If you are keeping them in rep storage they are 100% exploitable, replicated storage behaves differently from values kept else where

Hi!

No they’re not. If you want to be educated more about the topic, feel free to PM me. :slight_smile: