local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")

local GameFunctionsFolder = ReplicatedStorage:WaitForChild("GameFunctionsFolder")
local NightValue = 

local Characters = ServerStorage:WaitForChild("Characters")

local EnemyMonkyMan = Characters.EnemyMonkyMan
local E1Settings = require(EnemyMonkyMan.Settings)

local function MonkyManPog()
    for i, v in pairs() do
    
    repeat
        task.wait(math.random(E1Settings.AI.MinWait, E1Settings.AI.MaxWait))
    
        local MovementOpportunity = math.random(1, 20)
        local Success
    
        if E1Settings.AI.AILevel >= MovementOpportunity then
            if E1Settings.AI.Locked then
                print(EnemyMonkyMan.Name .. " is locked; MovementOpportunity failed")
                return
            else
                Success = true
                E1Settings.AI.CanMove = true
                print(EnemyMonkyMan.Name .. " MovementOpportunity success [" .. MovementOpportunity .. "/" .. E1Settings.AI.AILevel .. "]")
            end
        else
            print(EnemyMonkyMan.Name .. " failed the MovementOpportunity")
            return
        end
        
        if Success and CanMove then
            E1Settings.AI.CurPosition += 1
            EnemyMonkyMan:SetPrimaryPartCFrame(workspace.Positions["MonkyPos" .. E1Settings.AI.CurPosition])
        else
            warn("An error may have occured, or CanMove has failed to be set to true\nChecking")
            if not E1Settings.AI.CanMove then
                warn("Current CanMove setting", E1Settings.AI.CanMove)
            else
                warn("Success value turned out to be the problem, repeating loop")
            end
        end
    until E1Settings.AI.CurPosition == E1Settings.AI.MaxPosition
end


MonkyManPog

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: