New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Why isn't the text script not working properly?

Asked by 13 days ago

Ok so, I have this local script where there would be text and next to the text would be the amount of money the player has and the problem is that the text is dissapearing every time the number or amount changes into a different number that the player has in it's leaderstats (or Leaderboard). please help me how to fix this.

local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local leaderboard = player:WaitForChild("Leaderboard")
local cash = leaderboard.Cash
local value = script.Parent

value.Text = "Funds: "..cash.Value

cash:GetPropertyChangedSignal("Value"):Connect(function()
    value.Text = cash.Value
end)

Note: This script is placed in StarterGui not in ServerScriptService

Just repeating that this is a Local Script not a Script

0
change line 9 to ... value.Text = "Funds: "...cash.Value ForeverBrown 322 — 12d

1 answer

Log in to vote
1
Answered by 12 days ago
Edited 12 days ago

When the text changes and the signal detects it, it only changes to the cash value.

local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local leaderboard = player:WaitForChild("Leaderboard")
local cash = leaderboard.Cash
local value = script.Parent

value.Text = "Funds: "..cash.Value

cash:GetPropertyChangedSignal("Value"):Connect(function()
    value.Text = "Funds: "..cash.Value
end)

I hope this helps. Let me know if it doesn't. I'd be glad to help.

0
I already had the answer at the comments but sure he's some free reputation points anyway for actually getting it right anyway. Simpletton 81 — 12d
0
Thanks. Glad to help though lol ChefDevRBLX 83 — 11d
Ad

Answer this question