How would I do this? I don’t need a script I just need an explanation.
Im not sure what data? But that can be done with a for loop if your asking.
For example, the script could grab the data from all players of lets say, money and then put it in a global value
If the money value of each player is in leaderstats, then something like this might work:
--Every second
while task.wait(1) do
--Get the Players and the Global Value
local Players = game.Players:GetPlayers()
local GlobalValue = game.ReplicatedStorage.GlobalCash -- Your Value
-- Loop through the players
for _, Player in ipairs(Players) do
local leaderstats = Player:FindFirstChild("leaderstats")
local Money = leaderstats:FindFirstChild("Money")
-- if the leaderstats or the money hasnt been found, exit early
if not leaderstats or not Money then return end
--set the value to 0 before adding all the players money
GlobalValue.Value = 0
GlobalValue.Value += Money.Value
end
--print the result
print(GlobalValue.Value)
end
1 Like
thank you, works great! i’ll probably make a few adjustments
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.