Greetings to all. Upon being successful in making an operable button that changes image on both the MouseEnter and on MouseClick events, I noticed that the pressed and released forms of the button worked just fine in displaying their images as required.
While implementing the MouseClick event though, The clicked form of the image appeared to be smaller due to being an exact clone of the pressed form though with a bright, transparent neon outline bordering the image.
This is not the problem, despite it being a slight hindrance in terms of adding distance and size to correctly make the clicked form of the button appear the same size as the pressed form.
The issue that I am undergoing is being able to use my ImageButton's (MDSettingButton in this case) current "X" and "Y" coordinates with resizing and re-positioning to make any image version of the button appear the same size as the button when it is not under any mouse event without being offset as well.
My attempted code is as displayed:
local MDSettingButton = script.Parent local MDGearLabel = script.Parent.GearLabel MDSettingButton.MouseEnter:connect(function() MDSettingButton.Image = script.PressedForm.Texture MDGearLabel.Image = MDGearLabel.PressedForm.Texture end) MDSettingButton.MouseLeave:connect(function() MDSettingButton.Image = script.ReleasedForm.Texture MDGearLabel.Image = MDGearLabel.ReleasedForm.Texture end) MDSettingButton.MouseButton1Click:connect(function() MDSettingButton.Image = script.PressedClickedForm.Texture MDSettingButton.Position = UDim2.new(0,0,0,0) MDSettingButton.Size = UDim2.new(0,0,0,0) end)
The main question is: What data would need to be inputted in the UDim2's content to make the "PressedClickedForm" appear the same size as what it began as: ReleasedForm?
(The reason I did not mention the tweaking of the "Pressed" form is due to it being the exact same size of the "Released" form. Both of these forms are 150 pixels long and tall, {0,150, 0,150})
How would this also be revised in direct reference to my post's inquiry? The output reads this as invalid.
MDSettingButton.Size = UDim2.new( 0, MDSettingButton.x, 0 ,MDSettingButton.y)
Uppercase X and Y