I am making an audio visualizer. When I try to tween the size of the GUI, it tweens it to 0,0,0,0 instead of the UDim2 I entered.
There is no code in my game that tries to change the X offset to 0 at any point, yet it ends up at 0. How is that possible?
My code:
local Frame = script.Parent.Visualizer
local sound = script.Parent.Song
while true do
for i,g in pairs(Frame:GetChildren()) do
if g:IsA("Frame") then
local num = math.clamp(sound.PlaybackLoudness*0.20,1,100)/100
print(num)
g.Size = UDim2.new(0,5,num,0)
wait()
--game:GetService("TweenService"):Create(g,TweenInfo.new(1.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.In),{Size = UDim2.new(0,5,0,2)}):Play()
g:TweenSize(UDim2.new(0,5,0,2), Enum.EasingDirection.In, Enum.EasingStyle.Cubic, 1.5, true)
end
end
end
Update: I fixed it by manually making a loop that changes the size. I still don’t know why the tween wasn’t working, so I will leave this unsolved since the original issue was not solved
Maybe change the override to false on the last parameter. Your tweens are taking place over 1.5 seconds so they may not complete before the next is called (i.e. overridden by true as last param) which will inevitably blow the values eventually to max or min.