How to change the size of a Tween to math.random?

So I want to make it so the parts size will be random every tween, but the script dosen’t run when I put math.random in the ‘Part properties table’.

local tween = game:GetService('TweenService')
local cNumb = 0.03

local info = TweenInfo.new(
	0.2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	math.huge,
	true,
	0.01
	
)

local props = {
	Size =  script.Parent.Size + Vector3.new(0, cNumb, 0)
}

local playanim = tween:Create(script.Parent, info, props)

playanim:Play()
1 Like

What do you change in your script when you attempt to use math.random? I’m sure everything would be fine if I did this:

local props = {
	Size =  script.Parent.Size + Vector3.new(0, math.random(cNumb, 1), 0)
}

Oh, and by the way, if math.random in this case gives you either 0 or 1, then just use this instead:

local Random = Random.new()
local randomNumber = Random:NextNumber(5, 9) --Returns any number between 5 and 9
1 Like

It still dosen’t work, like it dosent even change the size, this happened to me in the beggining.

1 Like

Hmm, if you used the Random code I sent above as an example, what happens? Also, can you send me a video of it running and the properties of the part so I can see what happens?

Yes I tried the Random code, but it didn’t work. Now for some reason its changing sie on all axis:

With math.random

With random

math.random seems to work, what’s the problem? If it’s the speed, remember that the TweenInfo is still the same, you’ll need to redefine it and somehow keep it somewhat proportional to the math.random

1 Like

The problem is that it’s supposed to move to the Y axis, but it moves on all of them (in this Part the Y axis is the front)

1 Like

I’m sure you’re using a mesh/union for the flag, unfortunately that’s how they are.

I’m going to sleep, won’t reply for a while