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

How do I convert an int value to a string that can be displayed on a GUI?

Asked by
KingDomas 153
4 years ago
Edited 4 years ago

I am not that good at scripting, and I am trying to make a simple game. I'd like to make a GUI that displays my money (bitcoin) into a ScreenGui. So like this, just updating all the time. https://gyazo.com/30adb1c8f1281f01f60fd3866108a56d

If I just try to make the value of bitcoin be read onto the GUI, then it says it cannot do it, as it is not a string. This is the code I am using for my money, by the way.

game.Players.PlayerAdded:Connect(function(player)

    playersLeft = playersLeft + 1

    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local bitcoin = Instance.new("IntValue")
    bitcoin.Name = "Bitcoin"
    bitcoin.Value = 0
    bitcoin.Parent = leaderstats

    player.CharacterAdded:Connect(function(character)
        character.Humanoid.WalkSpeed = 0
    end)
end)
0
Maybe try changing the value to a NumberValue instead of Intvalue. Aqu_ia 39 — 4y
0
No, that wouldn't solve it. Anyways, the suggestion below solved it. Thanks for the suggestion though! KingDomas 153 — 4y

1 answer

Log in to vote
0
Answered by
Benbebop 1049 Moderation Voter
4 years ago
Edited 4 years ago

tostring() will convert any value to a string. Try something like:

local string = tostring(IntValue)

Then set string to your gui's text. And IntValue to your IntValue.

Ad

Answer this question