How to zoom in/out of a ImageLabel with mousewheel?

Hello,

I’m trying to make a map viewing system, but I can’t seem to figure out how to make the image “zoom in” (scale up/down) with the mousewheel? Any assistance with this would be greatly appreciated. :slight_smile:

What if you detected when the mouse scrolls inwards then you tween the image label to a bigger size then visa versa for when you scroll out. If you’d like I can provide an example

This was what I had, but every time I scroll in it goes invisible, not too sure about Tweening.

gui.MouseWheelForward:Connect(function()

script.Parent.Size = UDim2.new(script.Parent.Size.X.Scale + 2, script.Parent.Size.Y.Scale + 2)

end)

gui.MouseWheelBackward:Connect(function()

script.Parent.Size = UDim2.new(script.Parent.Size.X.Scale - 2, script.Parent.Size.Y.Scale - 2)

end)

An example would be very much appreciated! :smiley:

To tween it do frame:TweenSize(UDim2.new(frame.Size.Scale.X + 0.01,0, frame.Size.Scale.Y + 0.01,0 And change it to a minus for when they scroll out

Hi, when using this code, I get this error: Scale is not a valid member of UDim2 - Any ideas what could be causing this?

Did you change frame to the location of the image label?

Yeah, I did, so I’m unsure where this error is coming from exactly

Can I see the code your using right now?

Oh did you place brackets on the end? I noticed when I wrote that I forgot to put 2 brackets on the end

It should be Size.X.Scale, not Size.Scale.X. Same applies for Y.

1 Like