How would I make it so when scrolling on a scrollingFrame it doesn't move the camera?

I have looked at this already but the answer that was given I believe was old and doesn’t apply to the current Roblox updates. I have a feeling how it would be done is setting the CameraMinZoomDistance and max distance equal to the same thing when the player hovers over the frame, but I can’t figure out how to get the value of the distance. On the script that was given, he wrote it in pseudocode which said:

Pseudocode:

local camDist = (Cam.CoordinateFrame.p - Head.Position).magnitude

However, I simply can’t figure out how to get the cameraDistance or any other way that might work. Any suggestions?

EDIT: This has to be done in a LocalScript as I’m working with GUIs.

=======================================================

EDIT2: I’ve been working on this for a while now, I’ve managed to freeze the GUI when the mouse is hovering but it is not at the correct distance, and it was frankly just a guess but I’ll show my code. I’m essentially being drove to insanity.

local zoomMin = 0.5
local zoomMax = 128
--local camera = game.Workspace.Camera.CFrame
local player = game.Players.LocalPlayer

donationFrame.MouseEnter:Connect(function()
	local camera = game.Workspace.Camera.CFrame.X
	--local cameraX = camera.X
	--local cameraY = camera.Y
	
	--local cameraDistance = cameraY - cameraX
	player.CameraMinZoomDistance = camera
	player.CameraMaxZoomDistance = camera
	
end)

donationFrame.MouseLeave:Connect(function()
	player.CameraMinZoomDistance = 0.5
	player.CameraMaxZoomDistance = 128
end)

2 Likes

Hello, I think I might know the solution to this but I’m not sure if this will make it what you want. Try to put Active on true and selectable on true this might work.

Nevermind, something so simple. Can’t believe I didn’t see that, thank you.

1 Like