Wiki
It show that we structure modules like this
local my_functions = {}
-- Add a few functions to the table
function my_functions.foo()
print("Foo!")
end
return my_functions
And call them like this
local my_functions = require(script.Parent.MyFunctions)
my_functions.foo()
But in the roblox player module it’s structured like this
function MouseLockController:OnMouseLockToggled()
--stuff here
end
If I wanted to fire this function OnMouseLockToggle() how would I do it?
Here’s what I have in a local script to test if this can fire
local MouseLockController = local MouseLockController = require(player:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule"):WaitForChild("CameraModule"):WaitForChild("MouseLockController"))
wait(7)
print("e")
MouseLockController:OnMouseLockToggled()
It’s giving me the error: PlayerScripts.PlayerModule.CameraModule.MouseLockController:161: attempt to index nil with ‘Fire’