Hi there, so I’m trying to scale a frame by using a script. And the way it’s supposed to work is if you left-click, it should resize the frame. It doesn’t work for some reason, but I knew I was pretty new when it comes to scaling/positioning UI objects using scripts. I did search for solutions in the DevForum and none of them seem to work.
Here’s the code:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local gui = script.Parent
local frame = gui.Frame
frame.Size += UDim2.new(0, 0, 0, 1)
As you can see, it’s supposed to resize the frame and add 1 pixel ( or something, idk) when you left-click but it doesn’t resize it. I checked for errors in the output, it printed nothing.
Oh wow I wish I knew they added it. I know I tried it like a year or two ago. Anyways I just did the frame.Size += UDim2.new(0, 0, 0, 1) in studio and it worked for me so maybe one of your variables is wrong. Try putting a print in the event to make sure the event fires aswell.
Alright so, here is my code and it works fine. If you want to try it out yourself then here is the file. Not sure why your way does not work since it works perfectly fine for me. Maybe you have a ui button in your way, since that when you press on it it Button1Down does not fire. (Also ignore the image button)
They actually work both ways, see the thing is that the script I posted isnt the full code. And I just realized that the script I in my post works fine, its just in my full script I did spot some issues in the whole script itself and I was doing some debugging myself. But thanks anyway.