Attempt to perform arithmetic (mul) on UDim and number

Hello, I am trying to change the canvas size to the number of songs but it is not working.

Error: LocalScript:4: attempt to perform arithmetic (mul) on UDim and number

local Songs = game.ReplicatedStorage:WaitForChild("Songs")
local SongSelectUI = script.Parent:WaitForChild("SongSelectUI")

SongSelectUI.SongList.CanvasSize = SongSelectUI.SongList.CanvasSize + UDim2.new(0, SongSelectUI.SongList.SongListElementSize.Size.Y * #Songs:GetChildren())
1 Like

This is a UDim, you would want to use Size.Y.Offset or Size.Y.Scale, or, alternatively, use SongSelectUI.SolgList.SongListElementSize.AbsoluteSize.Y

5 Likes