Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script Wont Change Text to have text with the value?

idk how to explain this but i want the script to change the number with to a value but the text stays the same, so its like it changes from Happiness = 100% to Happiness = 99%

local Number = game.ReplicatedStorage.Happiness
local Text = script.Parent

Number.Changed:Connect(function()
	Text.Text = "Happiness = " tostring(Number.Value)"%"
end)

1 answer

✓ Accepted answer

You need to use string concatenation to join them, you can do this by using two dots ..

local Number = game.ReplicatedStorage.Happiness
local Text = script.Parent

Number.Changed:Connect(function()
    Text.Text = "Happiness = "..tostring(Number.Value).."%"
end)

1 comment

0

Alternative way is string.format()

This discussion is preserved as it was. New answers, comments, and votes are closed.