Module Script attempt to index nil?

I have a server script which requres a module script and uses its functions, but for some reason i keep getting the error "attempt to index nil with ‘Ice’ "

Module script:

local powers = {}

	Functions = {
		Ice = {
	
			Move1 = function(player)
				print("Move1 works")
			end	
		}
	}
	

return powers

Server Script:

local Modules = ReplicatedStorage:WaitForChild("Modules")
local powerFunctions = require(Modules:WaitForChild("PowerFunctions"))

powerFunctions.Functions.Ice.Move1()

You declared Functions as a global variable, not as a field of the table.

local powers = {
	Functions = {
		Ice = {
			Move1 = function(player)
				print("Move1 works")
			end	
		}
	}
}
2 Likes