I am currently trying to make a system where every players current cash is shown to every client. I've done this by having a script which gets the Cash value of each player and set a value in Replicated Storage to it. The client then gets this value and sets a text label's text to this value.
However, when I run this, the server script throws this error:
attempt to index nil with 'PlayerGui'
I'm not sure why this is happening as the server can access the playergui from what I know.
The server script:
HttpService = game:GetService("HttpService") plrsTable = HttpService:JSONDecode(game.ReplicatedStorage.plrs.Value) while wait() do game.ReplicatedStorage.plrData.Cash1.Value = game.Players:FindFirstChild(plrsTable[1]).PlayerGui.Cash.Value game.ReplicatedStorage.plrData.Cash2.Value = game.Players:FindFirstChild(plrsTable[2]).PlayerGui.Cash.Value game.ReplicatedStorage.plrData.Cash3.Value = game.Players:FindFirstChild(plrsTable[3]).PlayerGui.Cash.Value game.ReplicatedStorage.plrData.Cash4.Value = game.Players:FindFirstChild(plrsTable[4]).PlayerGui.Cash.Value end
(plrsTable is a table of all players in the game)