Hey! I’ve just created a draggable gui, by using this module. It works fine, however, I’d like to make some limitations for the drag. I want it to be able to drag to only some position values, basically I don’t want to make the player be able to drag it freely, wherever on the screen. (I’d like to make it look more like a “zooming” of a full-screen frame, instead of moving the frame across the screen.)
I made a script, which however doesn’t work. Does anyone know how I could achieve this?
The code:
local DraggableObject = require(script.Parent.DraggableObject)
local FrameDrag = DraggableObject.new(script.Parent)
local Frame = script.Parent
FrameDrag.DragStarted = function()
if Frame.Position.Y.Scale > -0.001 and Frame.Position.Y.Scale < -0.584 and Frame.Position.X.Scale > -0.074 and Frame.Position.X.Scale < -0.874 then
FrameDrag:Enable()
else
FrameDrag:Disable()
end
end