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

How do I update Text with Text and a Value? Error Shown.

Asked by
Moxeh 84
6 years ago

How do I fix this error? I am trying to update a TextLabel with the predefined text 'Lvl' followed by their current Level. I am getting an error returning as:

19:23:27.968 - Players.Moxeh.PlayerGui.Store.MasterStore.RocketUpgradeFrame.SpeedLevel.Speed.U:5: ')' expected near ','

local stat = game.Players.LocalPlayer.PlayerStats:findFirstChild('SpeedLvl')
local cost = game.Players.LocalPlayer.PlayerGui.Store.MasterStore:findFirstChild('LevelCosts')
stat.Changed:connect(function (property)

    script.Parent.Text = ('Lvl', stat.Value)
end)

1 answer

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
6 years ago

We can use Concatenation which uses '..'

For example let's setup a variable and then print it with a string

local l = 10
print("Lvl: "..l.." is the level that I'm at")
0
Had to modify it a little, but the Concatenation link solved my issue. Thank you! Moxeh 84 — 6y
Ad

Answer this question