Plugin Stopping when doing require() for a modulescript

  1. What do you want to achieve? I want to require a modulescript through my plugin

  2. What is the issue? i am doing require() correctly with no syntax error but it seems that the plugin script just stops

  3. What solutions have you tried so far? I have done a quick google search and around the devforum

here is part of the main script:

print("Running Plugin")

local toolbar = plugin:CreateToolbar("Remind Me")
local settingsButton = toolbar:CreateButton("Open Settings", "Open Remind Me Settings", "rbxassetid://5606240016")

print("Runs") -- prints

local UIManager = require(script.Parent.UIManager) -- Line that stops all the code
print("UI") -- does NOT run
local ClockModule = require(script.Parent.UIManager.UpdateClocks)
print("Clock")
local TweenModule = require(script.Parent.TweenModule)
print("Tween")

here is the modulescript for the UIManager:

local CoreGUI = game:GetService("CoreGui")
local SoundService = game:GetService("SoundService")
local TweenModule = require(script.Parent.TweenModule)
local ClockModule = require(script.UpdateClocks)
local EventModule = require(script.Event)

local TopTweenPos = {UDim2.new(0.5, 0, -0.01, 0), UDim2.new(0.5, 0, -0.3, 0)}
local RemindTweenPos = {UDim2.new(1.015, 0, 0.862, 0), UDim2.new(1.5, 0, 0.862, 0)}

local RemindImages = {
	['Breakfast'] = "http://www.roblox.com/asset/?id=5605699715",
	['Lunch'] = "http://www.roblox.com/asset/?id=5605700166",
	['Dinner'] = "http://www.roblox.com/asset/?id=5605986840",
	['Water'] = "http://www.roblox.com/asset/?id=5605700979",
	['Audio'] = "http://www.roblox.com/asset/?id=302250236"
}

local RemindFlavorText = {
	['Breakfast'] = "Remember to go eat Breakfast soon!",
	['Lunch'] = "Make sure to go eat a healthy Lunch and take a small break!",
	['Dinner'] = "Go eat some dinner soon!",
	['Water'] = "If you aren't making progress go take a break and Hydrate!",
	['Audio'] = "You're Reminder went off!"
}

local module = {}

module.RemindDb = false

function module:init(clonedUI) --Initializes plugin
	
	print("Initializing Remind Me...")
	
	local ViewportUI
	
	if CoreGUI:FindFirstChild("ViewportUI") then
		for i,v in pairs(CoreGUI:GetChildren()) do
			if v.name == "ViewportUI" then
				v:Destroy()
			end
		end
		ViewportUI = clonedUI.ViewportUI
		ViewportUI.Parent = CoreGUI
	else
		ViewportUI = clonedUI.ViewportUI
		ViewportUI.Parent = CoreGUI
	end
	
	ViewportUI.Top.Position = TopTweenPos[2]
	ViewportUI.Remind.Position = RemindTweenPos[2]
	
	if plugin:GetSetting("Custom") then -- follows custom settings
		
	else -- if plugin did not have settings changed
		EventModule:SetEvent("07:30", "Breakfast", "Breakfast") -- Breakfast
		EventModule:SetEvent("12:00", "Lunch", "Lunch") -- Lunch
		EventModule:SetEvent("18:30", "Dinner", "Dinner") -- Dinner
		EventModule:SetIntervalEvent(60, "Water", "Water") -- Water Reminders
	end
	
end

function module:Remind(object, length, picture)
	
	if module.RemindDb == true then return "no" end
	
	delay(0, function()
		
		module.RemindDb = true
		
		ClockModule:UpdateClock(object.Text, 1) -- Updates Remind Clock
		object.Image.Image = RemindImages[picture]
		object.Text.Text = RemindFlavorText[picture]
		
		TweenModule:Tween(object, RemindTweenPos[1], .2)
		
		SoundService:PlayLocalSound(script.Parent.Sound.RemindDing)
		wait(length/5)
		SoundService:PlayLocalSound(script.Parent.Sound.RemindDing)
		wait(length/5)
		SoundService:PlayLocalSound(script.Parent.Sound.RemindDing)
		wait(length/3)
		
		TweenModule:Tween(object, RemindTweenPos[2], .3)
		
		module.RemindDb = false
		
	end)
end

function module:topEnter(object)
	object.Visible = true
	TweenModule:Tween(object, TopTweenPos[1], .2)
end

function module:topLeave(object)
	delay(0, function()
		TweenModule:Tween(object, TopTweenPos[2], .2)
		wait(.2)
		object.Visible = false
	end)
end

return module

I am storing my local plugins inside of a folder on my desktop if that might have something to do with it

I am also a bit new to using module scripts and plugins so sorry if its something easy :confused:

Here is the plugin file because I’m that desperate lol: Remind_Me.rbxmx (29.6 KB)

1 Like

Those lines might be the ones stopping the code. The UIManager has no syntax errors, so it must be something above it. Try printing after toolbar and settingsbutton

2 Likes

hmm i put a print(“Run”) underneath those two lines but it did print :confused:
the print() underneath the UIManager variable does not print tho so it has to be something with that line of code

OK, I will try that. Thanks for your help :grinning:

Whats the script for the toolbox module?

i do not have a toolbox module. Do you mean the clock or tween module?

Do you have anything before these lines?

I have this but its just commented out

---------------
-- Remind Me --
---------------------------
-- By: Gameknight9992005 --
---------------------------
-- Note: Feel Free to borrow
-- any modulescripts/code/UI you want
-- :D (Please do not just reupload the 
-- plugin tho [ That would be mean :( ])

Do you have any plugin module in your game?

No, none of my games are using plugins

im using roblox’s plugin thing (idk what to call it) that lets me create the plugin but i do not have any modules that i have created

Can you link me the plugin i can check it out and see if you did something wrong

ok it isn’t finished tho so some of the code is really unfinished

2 Likes

have you found any bugs in your plugin?

uhh i mean yea thats why im here lol, the require() for some reason is stopping my main script when i run the plugin

I’ve looked into the plugin, and sorry but it wasn’t even opening for me for some reason. Sorry for not fixing your issue. :confused:

Issue is not solved yet :confused:
please if you have any suggestions on how to fix this please tell me (I also did a quick reboot but it didn’t change anything)

I figured it out!!! I did not know that requiring a modulescript acctually ran code inside it when you called require() so my modulescripts were calling each other in an infinite loop! So i fixed that and now everything is working completely fine! :smiley:

2 Likes

Awesome! Good luck working on your plugin

1 Like