I’m trying to call Patrol from the Actions module script, but I’m recieveing this error:
18:50:15.213 - Workspace.MiniRock.Handler:5: Argument 2 missing or nil
18:50:15.213 - Stack Begin
18:50:15.214 - Script ‘Workspace.MiniRock.Handler’, Line 5
Which is “Actions.Patrol()”
18:50:15.214 - Stack End
return {
Startup = function()
Patrol = coroutine.wrap(function()
local function PatrolFunction()
if PatrolEnd then PatrolEnd = false return end
local Pos = HumRoot.Position
local Rand = function() return math.random(Data.RoamRange) end
local RandPos = Vector3.new(Pos.X+Rand(), math.huge, Pos.Z+Rand())
local Way = Ray.new(RandPos, RandPos*Vector3.new(1,-1,1))
local Clear, Point = workspace:FindPartOnRayWithIgnoreList(Way)
HumRoot.Rotator.CFrame = CFrame.new(HumRoot.Position, Point);
HumRoot.Rotator.P = 2000;
Hum:MoveTo(Point)
repeat
wait()
until (HumRoot.Position - Point).magnitude <= 1.5
PatrolFunction()
end
PatrolFunction()
end);
FindPlr = function()
MoveToPlr = function()
AttackPlr = function()
}
Above is the module script, with functions collabsed.
And below is the requiring of it.
--[[Variables]]--
local PatrolEnd = script.PatrolEnd
local Actions = require(script.Actions)
Actions.Startup()
Actions.Patrol()