Stats Gui isn't showing anything until values change

local player = game.Players.LocalPlayer
local gainMoneyGui = script.Parent.gainMoneyGui
gainMoneyGui.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.MoneyGain:FireServer()
	player.PlayerGui.mainGui.moneyLabel.Text = "Money: "..player.leaderstats.Money.Value
	player.PlayerGui.mainGui.rebirthsLabel.Text = "Rebirths: "..player.leaderstats.Rebirths.Value
end)
game.Players.PlayerAdded:Connect(function()
	player.PlayerGui.mainGui.moneyLabel.Text = "Money: "..player.leaderstats.Money.Value
	player.PlayerGui.mainGui.rebirthsLabel.Text = "Rebirths: "..player.leaderstats.Rebirths.Value
end)

The GUIs dont show anything until the values change.

1 Like

What do you mean “the GUIs dont show anything?” Do you mean that the values aren’t shown? If that’s the issue, try a :WaitForChild() so the GUIs are fully loaded in.

1 Like

Because these are local GUI’s , I don’t think you need to use remote events.

Remote events are only needed if doing a server wide change

is it a server script or a local script?

cause if it is then modify the script like this:

local player = game.Players.LocalPlayer
local gainMoneyGui = script.Parent.gainMoneyGui

player.PlayerGui.mainGui.moneyLabel.Text = "Money: "..player.leaderstats.Money.Value
player.PlayerGui.mainGui.rebirthsLabel.Text = "Rebirths: "..player.leaderstats.Rebirths.Value

gainMoneyGui.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.MoneyGain:FireServer()
	player.PlayerGui.mainGui.moneyLabel.Text = "Money: "..player.leaderstats.Money.Value
	player.PlayerGui.mainGui.rebirthsLabel.Text = "Rebirths: "..player.leaderstats.Rebirths.Value
end)

that way when the script runs it will put the text once and then updates it when you click

that didnt work, the text didnt update till i clicked it

Instead of FireServer use GetProperyChangedSignal