Heya There!
I’m working on a bit of an enemy module for a PVE game I’m working on. There’s an issue with the module script however, and as you can tell from the title, there’s a section of the module script where it doesn’t want to check the bosses folder.
There is a strip of code in the CreateEnemy
function where it checks to see if an enemy exists in either the Common
or Bosses
folder. Otherwise, warn and return. It seems to work on normal enemies, but not bosses.
Here’s a snippet of the module script.
--[[SERVICES]]--
local ServerStorage = game:GetService("ServerStorage")
--[[FOLDERS]]--
local EnemyFolder = ServerStorage:WaitForChild("Enemies")
local CommonEnemiesFolder = EnemyFolder:WaitForChild("Common")
local BossesFolder = EnemyFolder:WaitForChild("Bosses")
--[[MODULE]]--
local EnemyHandlerModule = {}
EnemyHandlerModule.__index = EnemyHandlerModule
--//General
function EnemyHandlerModule:CreateEnemy(EnemyName, Amount)
local RequestedEnemy = CommonEnemiesFolder:FindFirstChild(EnemyName) if RequestedEnemy == nil then
print("Cannot find: "..EnemyName.." Checking the bosses folder.")
BossesFolder:FindFirstChild(EnemyName) if RequestedEnemy == nil then
warn("Cannot find enemy: "..EnemyName)
return
end
end