TextLabel not showing text

Hello everyone. I’m trying to make a money display. The problem is that the TextLabel is not showing the text, even though it prints as it should. Here’s the script:

local money = game:GetService("Players").LocalPlayer:WaitForChild("leaderstats"):FindFirstChild("Money")
local text = script.Parent.Text
print(money.Value)
print(text)
money.Changed:Connect(function()
	text = "$" .. money.Value
end)

Thanks for reading.
Edit: The script is working fine. When I print the variable text, I get $1, which is the value of the money. My problem is that it doesn’t show on the gui.

2 Likes

Text.value =

30 characters ehjehyenshe

I think script’s parent is the Textlabel so Text.Value wouldn’t work.

Is the script inside the text label?

This is a pretty simple problem, try using this instead:

game.Players.LocalPlayer:WaitForChild("leaderstats").Money.Changed:Connect(function()
script.Parent.Text = "$"..game.Players.LocalPlayer.leaderstats.Money.Value
end
1 Like

this still does not work for me.

Maybe local text = script.Parent.Text.Text

You can’t have a $ symbol in the text. Sorry, but it’s not actually possible to do that. Roblox can’t show things like symbols in a intvalue.

Still doesn’t show if I delete the symbol.

This has to be a local script inside the TextLabel. Also just do game.Players.Localplayer. I think the issue I
Has to do with where the script is. Or whether it’s a LocalScript.

Don’t include “Text” in the text variable because the script will think it’s an object.

To easily fix this, just change the name of text to [MoneyText] or something like that, then do MoneyText.Text

I had a situation where one of my buddies did this, and the fix above worked for him.

Hmm, why not try and do this instead:


text = "$", money.Value

And also it’s because your putting the function after you printed text and money.Value to begin with.

Put the prints inside of the function instead of outside it.

It shouldn’t matter. But it might. Try doing.tostring on the money value before concatenation first as a string.

Pointless, just change text to a different variable next then reference the text property

local money = game:GetService("Players").LocalPlayer:WaitForChild("leaderstats"):FindFirstChild("Money")
local moneyTextLabel = script.Parent.Text

money.Changed:Connect(function()
moneyTextLabel = "$" .. money.Value
end)

This should work.

1 Like

Agreed if you are naming your TextLabel “Text” then you are going to have a tough time of getting the actual TextLavel as a child. If you want to keep it as “Text” do FindFirstChild(“”)

Try to replace as:

while wait() do
    text = "$"..money.Value
end

The text will always be the ammount you have, dont need to change the amount to update the GUI

Try changing the TextLabel’s ZIndex. :man_shrugging: It’s worth a shot.

Don’t call the “Text” property from a variable, call the parent, and then use the variable when needed. :sunglasses:

3 Likes

I was hesitant in this being the solution because it printed out the correct values, as you stated.

The only reason why it may have printed nothing is that it is being changed, and then it calls the older stored value. :exploding_head:

Thanks for marking my solution! :+1:

1 Like