Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is TextLabel.Text not changing?

Asked by
Yukogan 72
4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
0
Thanks! I'll try it. Yukogan 72 — 4y
0
It doesn't work. I'll just remove it. Thanks for the help! Yukogan 72 — 4y
Ad

Answer this question