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

How do I make it so that the text updates correctly?

Asked by
nanaluk01 247 Moderation Voter
9 years ago

The only thing that does not work is that the text of the TextBox is not being updated.

wait(2)
for _,v in pairs(workspace:GetChildren()) do 
    if v:IsA('BasePart') and not v.Name == "Terrain" then 
        v.Touched:connect(function(hit) 
            local player = game.Players:GetPlayerFromCharacter(hit.Parent)
            if player ~= nil then
                local cash = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
                game.Workspace.Display.GUI.Amount.Text = "$ "..cash.Value
                end
        end) 
    end 

end

1 answer

Log in to vote
0
Answered by 7 years ago

Use the Changed Event. Basically, when the Value of the Cash changes, it will fire a function and change the text. Here is an example:

cash.Changed:connect(function()
game.Workspace.Display.GUI.Amount = "$ "..cash.Value
end)

What the above will do is it will update the text every time the Value is changed.

0
This question was posted over a year ago.... xD I know how to do it now. nanaluk01 247 — 7y
Ad

Answer this question