Introducing Easy Dragging (v0.0.1)
Get v0.0.1
Find other versions under here
Hey Devs!
I have recently come to notice that there aren’t any simple smooth dragging modules out there, so I have created this. Easy Dragging provides you with a simple yet satisfying way to add a dragging function to your UI objects.
Showcase (Dragspeed set to 8):
How do I start?
When you have imported the module, you can start by creating a new dragger in a Localscript
or a Script
with it’s RunContext
property set to Client
. Start with this code:
local EasyDragging = require(path.to.easydragging.module) -- Loads the module
local Dragger = EasyDragging.new(YOUR_DESIRED_SPEED) -- Creates a new Dragger
Now that you have successfully created a dragger, add a Gui object to this like this:
Dragger:AddObject(path.to.your.ui.object) -- Adds a Gui Object to your Dragger
Now your Gui object should be able to be dragged around.
Removing a Gui object
You can remove a Gui object from the Dragger by simply calling this function:
Dragger:RemoveObject(path.to.your.ui.object) -- Removes a Gui Object from your Dragger
Removing a Dragger
To destroy a dragger, call this function (WARNING: Destroying a dragger is not the same as removing an object, one simply removes the Gui object from the dragger, and one destroys the whole dragger disabling further use):
Dragger:Destroy() -- Removes your Dragger completely
Manually Updating a Dragger
If you want to update your dragger on something else than a drag, you can call the function below (Keep in mind that for this a delta time is required):
Dragger:Update(YOUR_DELTA_TIME) -- Updates your Dragger manually
That’s it for now. If there is any confusing or any bugs occur, feel free to comment on this post.
Feedback is also appreciated!
Happy Coding!