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
Cyafu
(Cyafu)
September 2, 2020, 8:19pm
#2
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
Fem1Craft
(Fem1Craft)
September 2, 2020, 9:16pm
#7
Instead of FireServer use GetProperyChangedSignal