Tweening stringvalues

so im currently trying to tween a value thats a string but everytime it runs i get

TweenService:Create property named ‘Value’ on object ‘Value’ is not a data type that can be tweened

im not entirely sure how im supposed to be doing this but, im creating a variable to read the cash value before the number changes, and then another for what the value is after the player sells something, I would like to have the stringvalue that was created to be tweened to start at the old value and smoothly climb up to the new value, I plan on using this value as a text display somewhere in a gui but for now I need to make sure it works

	local lstats = player:WaitForChild("lstats")
	local cash = player.lstats.Cash.Value
	local tweenInfo =
	local Casher ="StringValue")
	Casher.Parent = player.lstats
	Casher.Value = player.lstats.Cash.Value
	player.lstats.Cash.Value += player.lstats.Ore.Value
	local cash2 = player.lstats.Cash.Value
	local goal = {}
	goal.Value = cash2
	TweenService:Create(Casher, tweenInfo, goal):Play()
	player.lstats.Ore.Value = 0

You can’t tween a string, I would instead use/create a Lerp function.


Try tweening a number value instead and setup a changed event for said number value to update the string value with the number value.


You can’t interpolate a string linearly either.

What they need to do is use numbers 1 through 26 to represent each character of the English alphabet and then tween/lerp those numbers instead.

1 Like

You cannot interpolate string values, nor should you try (it’s impractical).

Instead, tween a number value that will later convert to a string. If you have, 1000 cash, then a number value should tween to 1000 as a number, not as a string.


Firstly, as already noted, you cannot tween a string value. But presumably your ‘cash’ is a number, and instead you’d use a NumberValue instead, which can be tweened.

If you want to use this in a UI, you would need to update your TextLabel every frame to show the tweening of the number because it would not update automatically from the NumberValue. With this, if needed, you can convert it into a string and append any other strings ie. £ or $ or ‘Cash’. I think that’s what you intend to do.

1 Like

the string values do not contain any alphabet, its a string due to numbervalue limitations

i have a leaderstats and an lstats folder, the leaderstats just reads lstats and abbreviates it and concats the money sign

	player.leaderstats.Cash.Value = "$"..MoneyLib.DealWithPoints(tonumber(player.lstats.Cash.Value))

i could probably use the number value but once it hits that limitation i wont be able to have the text go up smoothly since the string exceeds it

1 Like

Unfortunately, the only way to tween a number is with a NumberValue or IntValue. You would use an IntValue behind the scenes, to tween the cash value, and then update the stats string value every frame.

I also don’t understand what you mean by the limitations of NumberValue. Plus, if you want to store a cash value in the player, ideally you’d leave it as a number, and then any code that uses it would convert it into a string, or is that because of the ‘limitations’?


the max number i mean, intvalue for example caps out at 9.22qn, with strings i dont have that limitation

1 Like

I don’t know why you would ever need to exceed that limitation?

1 Like

The code snippet mentions cash, and so I assumed they wanted to tween the cash (number) portion of the string. Lerping from (ex.) 10 → 100 is possible.

1 Like

Store it as an base 10, one decimal part and one exponent part.

	value = 1.39,
	exponent = 10
-- This would then be interpreted as 1.39 * 10^10

Alternatively, store it as a string “1.39e10”, which would be the same as the above. You may then tween each portion of the number independently. (Translate the e^10 to appropriate shortening [such as qn])

1 Like

I’m having the same issue, But in my case I’m using BigNum to store bigger numbers but this makes me unable to tween it? I cannot use numbers since the numbers are too big to be stored

If you want to tween a number, you can use NumberValue or IntValue