How would i make the Gui detection plugin work?

I made a topic about this earlier but i couldnt really find out what to do.
Im using the Gui detection plugin where you can make GUIS do stuff when they touch each other.

I’ve tried to do some research about it (looking at the original post, etc) and im still really confused. Ill provide some screen shots below.

(ALSO, please remember that im new to roblox generally especially coding so it would be best to make the answer in a very simple form)
By the way, I did require the code and its the only thing i did when i placed the script into replicated storage

This is the test ive put up
image
basically (atleast to my knowledge) I’ve made it so the “Frame” gets tweened into the Collider. when they touch, i want it to stop moving instead of going through it

This is the code i’ve put in the screenGUI

local GuiCollisionService = require(game.ReplicatedStorage.GuiCollisionService)
local Frame = script.Parent.Frame 
local Collider = script.Parent.Collider 

GuiCollisionService.isColliding(Frame, Collider)

when i run the code, i get this
image
I have no idea what this means at all but it probably means im doing something incorrect.

If im doing anything wrong, please let me know.

(ALSO if there is a way to make it so when they collide it prints out something let me know!)

ALSO I MIGHT BE DOING EVERYTHING WRONG. If that is the case let me know!
(like all the script and the setup is wrong)

2 Likes

This error usually comes out when the module script fails to return. Module scripts are required to always return something i.e the basic setup being:

local Module = {}

return Module

if it fails to return, it’ll error and that message will print. It’s likely there is a typo somewhere in the code that may have been put in when you were either looking over its code, or even accidentally opening it and pressing a key without realization.

I just tried it again and im POSITIVE the only thing i did inside the script was

local GuiCollisionService = require(game:GetService("ReplicatedStorage").GuiCollisionService)

before it was

local GuiCollisionService = {}

(also i tried doing it with the {} but it didnt really change anything)

You’re misunderstanding, the actual GuiCollisionService script is what’s failing to return, not your own code, rather the script that’s having require() being ran on it.

I dont know if im just being a complete Idiot but what is mentioned earlier is the actual script


(the
![image|565x500](upload

What does your ReplicatedStorage folder look like? Do you have the necessary ModuleScript instance named “GuiCollisionService”?

image

Try adding a WaitForChild() then.

I would put this in the GuiCollisionScript, right?

And would I put something in the () or just leave it blank
(I don’t have access to my computer right now so I can’t really know)

local Replicated = game:GetService("ReplicatedStorage")
local Module = Replicated:WaitForChild("GuiCollisionService")
local GuiCollision = require(Module)

I tried putting this in both in the GuiCollision script and the other script and neither worked.