How would I use a module with a boolean?

I am very new to scripting a module script and I don’t know how to use a module that has a boolean on it.

  1. What do you want to achieve?
    Understand how to use a boolean in a module script.

  2. What is the issue?
    I don’t understand how to use a boolean in a module script.

  3. What solutions have you tried so far?
    None, I looked on the Developer Hub for topics on how to use boolean in a module script but couldn’t find any.

My module script:

local myModule = {}

myModule.UI = {
	["Blossom"] = true
}

My local script that I tried

local Module = require(game.ReplicatedStorage.myModule)

local Object = script.Parent.Parent.Frame
local Button = script.parent

Button.MouseButton1Click:Connect(Function()
	if Module.UI.Blossom == true then
		Object.BackgroundColor3 = color3.fromRGB(255, 0, 255)
	end
end)
1 Like

Could you show your entire module code?

1 Like

Try this:


local Module = require(game.ReplicatedStorage.myModule)

local Object = script.Parent.Parent.Frame
local Button = script.parent

Button.MouseButton1Click:Connect(Function()
	if Module.UI[“Blossom”] == true then
		Object.BackgroundColor3 = color3.fromRGB(255, 0, 255)
	end
end)

1 Like

I showed you my entire module code already

local myModule = {}

myModule.UI = {
	["Blossom"] = true
}
1 Like

It has a lot of incomplete statements, so it doesn’t work.

local myModule = {}

myModule.UI = {
	["Blossom"] = true
}

return myModule
1 Like

Oh, I forgot the return. It works now. Thanks a lot!

1 Like