I’m assuming OriSize is defined out of the click function as something like local OriSize = butto.Size? If so then simply doing butto.Size = OriSize will work fine, as OriSize is already a UDim2 value.
is the code snippet you sent in the original post the full script? Because the function is missing an end) statement, which would be causing an error. Alongside missing local before defining button and OriSize.
Just create a attribute on the part, and copy-paste the part’s size over their. You can name it whatever you want, I’d name it something like “DefaultSize”, and then in the script just reference it:
Okay, I finally figured it out. First move your button to the middle of the screen. Then set your anchor point to 0.5. Move your button back to where it was. Add an attribute that is called “size”. The contents of that should be the size without the brackets “{}” Now that you have done that, you add your script.
local butto = script.Parent
butto.MouseButton1Click:Connect(function()
local size = tostring(butto:GetAttribute("size"))
local split = string.split(size,',')
butto.Size = UDim2.new(0, 50,0, 50)
wait(1)
butto.Size = UDim2.new(split[1],split[2],split[3],split[4])
end)