Can someone explain why this single line of code wont work?

dont know why just says expected umdi2 value

new.CornerRadius = Button1.Value..","..Button1.Value
1 Like

maybe this would work

new.CornerRadius = UDim.new(0, Button1.Value)
1 Like

A UICorner is a GUI object that can change change the
smoothness of another GUI objects corners. It has a property called CornerRadius. As you may know, all object properties have a specific type of value that it is restricted to. CornerRadius’s have a value type UDim, which is one-dimensional value with two components, a relative scale and an absolute offset, and of course… a UDim2 value is a two-dimensional value usually used for setting the position and size of GUI objects. UDim’s consist of 2 parameters which define it’s Size and Offset. You can create a UDim value by using this code.

local newValue = UDim.new(0.2,0)

In this case, the scale would be 0.2 and the offset would be 0. You can do the same with UDim2 by using UDim2.new and adding 2 extra parameters being the second scale and offset. In UDim2, the first two parameters make up on the X axis, and of course, the next 2 parameters make up on the Y axis. Now that you understand this, your new code should look like this…

new.CornerRadius = UDim.new(Button1.Value, Button1.Value)

Not sure if you were trying to set both the Scale and Offset to Button1.Value but if you want to set the Scale and Offset to different numbers then you could create a second value, one for Scale and one for Offset. Remember, Scale goes first and Offset comes next. Both are numbers.

I know you already have a solution to this, but it should help with any of your future codes. Thank you for reading this, and good luck with your codes!

2 Likes