Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is TextLabel.Text not changing?

Hi. For my game I have a rank system for cats. (Something like adopt me)

I tried to make that when your pet is full-grown, the rank will change with this simple code:

script.Parent.Text = -"Full Grown (level "..level")"

But it won't change...

When I do:

print(script.Parent.Text)

or

print(player.Character.blahblahbah.Cat.blahblahblah.BillboardGui.TextLabel.Text)

it prints the right text.

Does someone know why the text doesn't show anything, but when I print it, is says that the text is Full Grown with the level?

Here is the full code:

wait()
local player = game.Players.LocalPlayer
local leaderstats = player.leaderstats

leaderstats.Level.Changed:Connect(function()
	local level = leaderstats:WaitForChild("Level").Value
	--print(script.Parent.Text)
	script.Parent.Text = -"Full Grown (level "..level")"
	--print(script.Parent.Text)
	
end)

Hope someone can help :)

Yuri

1 answer

Try this,

wait()
local player = game.Players.LocalPlayer
local leaderstats = player.leaderstats

leaderstats.Level.Changed:Connect(function()
    local level = leaderstats:WaitForChild("Level").Value
    --print(script.Parent.Text)
    script.Parent.Text = "Full Grown"..Value
    --print(script.Parent.Text)
end)

or

wait()
local player = game.Players.LocalPlayer
local leaderstats = player.leaderstats

leaderstats.Level.Changed:Connect(function()
    local level = leaderstats:WaitForChild("Level").Value
    --print(script.Parent.Text)
    script.Parent.Text = "Full Grown"..level
    --print(script.Parent.Text)
end)

2 comments

0

Thanks! I'll try it.

0

It doesn't work. I'll just remove it. Thanks for the help!

This discussion is preserved as it was. New answers, comments, and votes are closed.