Can anyone tell me why this module does not work?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I wan to create a GUI that you are able to drag
  2. What is the issue? Include screenshots / videos if possible!
    The issue is when I set up the module script into the game and run the functions it does nothing and gives no error in the output. This is the module right here:Simple Module For Creating Draggable GUI Elements
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Since there is no support for this module I have no idea what to do I tried setting it up like this:
    Here is the script
    ``
    local DraggableObject = require(game.StarterGui.ScreenGui.DraggableObject)

local FrameDrag = DraggableObject.new(game.StarterGui.ScreenGui.Frame)
FrameDrag:Enable()

FrameDrag.DragStarted = function()

end

You’re getting the object from StarterGui and not PlayerGui.

-- player gui is where everything is held, not startergui. StarterGui gets copied to playergui
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local DraggableObject = require(playerGui:WaitForChild("ScreenGui").DraggableObject)
local FrameDrag = DraggableObject.new(playerGui.ScreenGui.Frame)
FrameDrag:Enable()

FrameDrag.DragStarted = function()

end

In addition, put this in a LocalScript, not a server script

2 Likes

It still does not work I put in a local script and changed the script and it still does not work.

Do you get any errors or warnings?

Nothing no errors do you want me to send another screenshot of where I put everything.

Yea, it might a replication thing

and since Roblox built in function of draggable guis deprecated I don’t know what to do.

Alright, try this:

local DraggableObject = require(script.Parent.Parent:WaitForChild("DraggableObject"))
local FrameDrag = DraggableObject.new(script.Parent)
FrameDrag:Enable()

FrameDrag.DragStarted = function()

end

Make this a LocalScript and put it as a child of the Frame

Edit: I made a minor syntax error, I updated this

Nothing I will send another screenshot to see what I am doing wrong again

You ran a play test in studio right? If so, it might be an issue with the module.

FrameDrag.DragStarted = function()
    print("started dragging")
end

Try adding this to the FrameDrag.DragStarted function to see if it is working

It works now thank you for helping me I had to restart studio and now it gives me a message and I corrected it.Sometimes Roblox Studio is buggy

1 Like

Wait, are you saying it only works if the DragStarted function has that print method?

No, I was saying to put the print method in the function to see if it was working because the script may have been running but nothing was happening. It seemed to be an issue with their studio

Oh, alright. Just making sure, because otherwise I’d need to fix it on my end :grimacing:

1 Like