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

Script for making a textbox's text match an intvalue - not working?

Asked by 6 years ago
Edited 6 years ago
function CoinsToGUI()
local players = game.Players:GetChildren()

    for i = 1, #players do
        wait(0.01)

        local CurrencyGui = players[i].PlayerGui:WaitForChild("CurrencyGui")
        local Stats = players[i]:WaitForChild("Stats")
        local Coins = Stats:WaitForChild("Coins")
        local CoinText = CurrencyGui.CoinText.Text

        CoinText = " "..Coins.Value.." "

    end
end

while true do
    wait (0.01)
        CoinsToGUI()
end

Not sure why this script isn't working.... It's supposed to match the value called "Coins" that is in the player. There's no error in the output. When I manually change the value to 10 (or any number, let's call that x) the gui's text just stays as 0. Does someone know what's wrong with this?

0
On line 10, remove .Text and on line 12, after CoinText, add .Text thesit123 509 — 6y
0
Thank you! That worked! But one question, why did it work? VeryRaven 85 — 6y

Answer this question