funnyfunns
(funnyfunns)
October 28, 2021, 11:08am
#1
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
funnyfunns
(funnyfunns)
October 28, 2021, 11:16am
#3
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?
funnyfunns
(funnyfunns)
October 28, 2021, 11:22am
#5
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
funnyfunns
(funnyfunns)
October 28, 2021, 11:25am
#7
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