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

How to fix this script updating text everytime value changes?

Asked by
TechModel 118
3 years ago

Everytime the value of the bank "cash" i suppose, then it updates, but what i've done here is when i hover over the text, it shows the abbreviation value, full value if not hovered over. However if the value changes, while mouse enters the text with abbreviation on, then it updates back to full value. How do I fix this issue? I know why but I tried mouseentered == true and I don't think it sounds the right way to do it?

local player = game.Players.LocalPlayer

script.Parent.Text = player.stats.Bank.Value

player.stats.Bank:GetPropertyChangedSignal("Value"):Connect(function()
    script.Parent.Text = player.stats.Bank.Value
end)

script.Parent.MouseEnter:Connect(function()

    local player = game.Players.LocalPlayer
    script.Parent.Text = abbreviateNums(player.stats.Bank.Value)
end)

script.Parent.MouseLeave:Connect(function()

    local player = game.Players.LocalPlayer
    script.Parent.Text = player.stats.Bank.Value
end)
0
it is the right way to do it :/ sne_123456 439 — 3y

Answer this question