"Unable to find module for asset id" error, I saw that this is caused because the module is called "ModuleScript" or something else and it should be named "MainModule". But my module is named "MainModule" and I'm still getting the error. HTTP Services are on, can anyone help please?

PS: The module, when required on the account that has published it, it works completely fine, doesn't work if another account requires the same module

local module = {}

local plr = game:GetService("Players").LocalPlayer

if script.Parent:FindFirstChild("lightChangeRE") then
	script.Parent:WaitForChild("lightChangeRE").Parent = game:GetService("ReplicatedStorage")
end

local lightChangeRE = game:GetService("ReplicatedStorage"):WaitForChild("lightChangeRE")


--// functions

lightChangeRE.OnServerEvent:connect(function(plr, event, selcolor, light, EC, BC, FC, ALL, brightness, speed)

toggle = false



--[[
	
if event == "lightChangeRainbow" then
	for i,v in pairs(light:GetChildren()) do
					spawn(function()
		while true do
			wait()
			 local start = v:WaitForChild("MainLight").Color
             local End = Color3.new(math.random(),math.random(),math.random())
            for i = 0,1,speed do
	wait()
                local color = start:lerp(End,i)
                v:WaitForChild("MainLight").Color = color
                v.Color = color
    			 end

start = End
		end
		end)
	end
end

--]]


if event == "lightChangeRainbow" then
	toggle = true
	for i,v in pairs(light:GetChildren()) do
					spawn(function()
		while true do
			if toggle == true then
			wait()
			 local start = v:WaitForChild("MainLight").Color
             local End = Color3.new(math.random(),math.random(),math.random())
            for i = 0,1,speed do
	wait()
                local color = start:lerp(End,i)
                v:WaitForChild("MainLight").Color = color
                v.Color = color
    			 end
			elseif toggle == false then
				break
		
			end
			
		end
		end)
	end
	end




end)
return module

4 comments

0

dont spam

1

You need to be in a real roblox server to run modules created by other users.

1

You are using OnServerEvent and LocalPlayer on one script, you're doing something terribly wrong.

0

^ thanks for pointing that out, just realised lol