Can I do this? - QUICK QUESTION

So I wrote a line of code here

local stringvar = "Day"..NewData.Streak

All I want to know is if you can do this.

Thank you!

yes, but are you sure NewData.Streak is a string?

Here is more code that should answer the question

local NewData = {}
				NewData.Streak = 1
				NewData.LastLogin = os.time()
				
				if Premium.Value ~= true then
					local Reward = StreakRewards[NewData.Streak]
					local cash = game.ServerStorage.PlayerMoney:FindFirstChild(plr.Name)
					cash.Value = cash.Value + Reward * Multiplier.Value
					local stringvar = "Day"..NewData.Streak

NewData.Streak is a number… So should I do

local stringvar = "Day"..tostring(NewData.Streak)
1 Like

Yes, You can do but I think you can simply do “Day”…NewData.Streak as I think you can index strings with numbers.

1 Like