I made a module script for my plugin and it's stored inside the GUI of the plugin. When I require it using a script inside the Screen GUI (not literally), it does work but if I use the main part of the plugin, it doesn't work. I don't want to have to put 2 module scripts, one in the GUI and one where the main stuff of the plugin is. However if there's no fix I will. Please help! However this won't be a easy one. I would provide you with the output but absolutely no errors. However when I access the module script through the variable it doesn't display the functions and variables which I think are called suggestions! I also tried using the module script but it didn't work in ANY scope.

-- Work by TrustedInstaIler --
--[[
:::    :::  ::::::::  :::        :::::::::       :::    ::: :::::::::  ::: 
:+:    :+: :+:    :+: :+:        :+:    :+:      :+:    :+: :+:    :+: :+: 
+:+    +:+ +:+    +:+ +:+        +:+    +:+      +:+    +:+ +:+    +:+ +:+ 
+#++:++#++ +#+    +:+ +#+        +#+    +:+      +#+    +:+ +#++:++#+  +#+ 
+#+    +#+ +#+    +#+ +#+        +#+    +#+      +#+    +#+ +#+        +#+ 
#+#    #+# #+#    #+# #+#        #+#    #+#      #+#    #+# #+#            
###    ###  ########  ########## #########        ########  ###        ### 
This material is copyrighted and you cannot redistribute, claim this plugin is yours, or copy it in any way!
(!) Failing to meet this requirements will result in SERIOUS consequences! (!)
You're allowed to modify your own copy, but cannot share it any way!
If somebody told you to put any code here, you have a 11/10 chance you're being scammed and your game will likely be infected!
If you're reading this and you're not the owner of the plugin but TrustedInstaIler also isn't the owner of this plugin, REPORT THE OWNER NOW!
--]]

First I set the variable for the GUI... then set it's parent... (removing the parent thing doesnt work) then I required two module scripts, and using them didn't work!

GuiMain = script.Parent.DevEssGui
GuiMain.Parent = game.CoreGui
alerts = require(GuiMain.AlertMaker)
sounds = require(GuiMain.SoundSystem)
alerts.makeAlert("The contents of the alert","The button text")
module.playSound("Alert")

Module scripts:

local module = {}
sounds = require(script.Parent.SoundSystem)

function module.makeAlert(text, button)
	sounds.playSound("Alert")
	local alert = script.Alert:Clone()
	if text ~= nil then
		alert.Content.Text = text
	end
	if button ~= nil then
		alert.Button.Text = button
	end
	alert.Button.MouseButton1Click:connect(function()
		alert:Destroy()
	end)
	alert.Parent = game.CoreGui.DevEssGui
end

return module

local module = {}
-- Sound module, have no idea why the heck the scripts arent splitting like they should, and I cant explain what I mean

function module.playSound(sound)
	if script:FindFirstChild(sound) then
		stp = script:FindFirstChild(sound)
	end
	game:GetService("SoundService"):PlayLocalSound(stp)
end

return module

Recommended to read:

-- Work by TrustedInstaIler --
--[[
:::    :::  ::::::::  :::        :::::::::       :::    ::: :::::::::  ::: 
:+:    :+: :+:    :+: :+:        :+:    :+:      :+:    :+: :+:    :+: :+: 
+:+    +:+ +:+    +:+ +:+        +:+    +:+      +:+    +:+ +:+    +:+ +:+ 
+#++:++#++ +#+    +:+ +#+        +#+    +:+      +#+    +:+ +#++:++#+  +#+ 
+#+    +#+ +#+    +#+ +#+        +#+    +#+      +#+    +#+ +#+        +#+ 
#+#    #+# #+#    #+# #+#        #+#    #+#      #+#    #+# #+#            
###    ###  ########  ########## #########        ########  ###        ### 
This material is copyrighted and you cannot redistribute, claim this plugin is yours, or copy it in any way!
(!) Failing to meet this requirements will result in SERIOUS consequences! (!)
You're allowed to modify your own copy, but cannot share it any way!
If somebody told you to put any code here, you have a 11/10 chance you're being scammed and your game will likely be infected!
If you're reading this and you're not the owner of the plugin but TrustedInstaIler also isn't the owner of this plugin, REPORT THE OWNER NOW!
--]]

1 comment

0

This post should now be closed. It does work, but alert doesn't work.