Hello, me and my developer friend have experienced a very odd issue.
All of our server scripts are placed in server script service and they dont fire for some weird reason. The print is not running even after debugging everything:
local WaveHelper = require(game.ReplicatedStorage.Modules.WaveHelper)
print("Started spawning")
WaveHelper:StartWave(1, 1200, {"Brawler", "Ranger"}) -- current wave, points, available enemies
If anyone has info on this topic please reply. Or if you want to know more info also please reply.
Note: this may be a roblox issue.
function WaveHelper:StartWave(Wave, MaxPoints, UnlockedEnemies)
print("Spawining Enemy lol")
if #workspace.Enemies:GetChildren() == 0 then
local NewWave = WaveHelper.new(Wave, MaxPoints, UnlockedEnemies)
task.defer(function()
while NewWave.MaxPoints > 0 do
print("while loop")
local RndIndex = math.random(1, #UnlockedEnemies)
local RndEnemy = UnlockedEnemies[RndIndex]
local EnemyModel = game.ServerStorage.Enemies[RndEnemy]
task.wait(.1)
if EnemyModel.Points and NewWave.MaxPoints >= EnemyModel.Points.Value then
NewWave.MaxPoints = NewWave.MaxPoints - EnemyModel.Points.Value
print("checks passed")
SpawnMob(EnemyModel, math.random(0,30), 5, math.random(0,30))
task.wait(0.1)
end
end
end)
task.wait(0.1)
end
end
local ServerStorage = game:GetService("ServerStorage")
local Modules = ServerStorage.Modules
local EnemyModules = Modules.EnemyModules
local EnemyModules = {
["Brawler"] = require(EnemyModules["Brawler Enemy Module"])
}
local WaveHelper = {}
WaveHelper.__index = WaveHelper
function WaveHelper.new(Wave, MaxPoints, UnlockedEnemies)
local self = setmetatable({}, WaveHelper)
self.MaxPoints = MaxPoints
self.CurrentWave = Wave
self.UnlockedEnemies = UnlockedEnemies
return self
end
local function SpawnMob(Mob, X, Y, Z)
local NewMob = Mob:Clone()
NewMob.Parent = workspace.Enemies
NewMob:SetPrimaryPartCFrame(CFrame.new(X,Y,Z))
local EnemyName = NewMob.Name
local ChosenModule = EnemyModules[EnemyName.." Enemy Module"]
if ChosenModule == nil then warn("ENEMY MODULE IS NOT LOCATED") end
ChosenModule.StartEnemyInstance(NewMob, {})
return NewMob
end
function WaveHelper:StartWave(Wave, MaxPoints, UnlockedEnemies)
print("Spawining Enemy lol")
if #workspace.Enemies:GetChildren() == 0 then
local NewWave = WaveHelper.new(Wave, MaxPoints, UnlockedEnemies)
task.defer(function()
while NewWave.MaxPoints > 0 do
print("while loop")
local RndIndex = math.random(1, #UnlockedEnemies)
local RndEnemy = UnlockedEnemies[RndIndex]
local EnemyModel = game.ServerStorage.Enemies[RndEnemy]
task.wait(.1)
if EnemyModel.Points and NewWave.MaxPoints >= EnemyModel.Points.Value then
NewWave.MaxPoints = NewWave.MaxPoints - EnemyModel.Points.Value
print("checks passed")
SpawnMob(EnemyModel, math.random(0,30), 5, math.random(0,30))
task.wait(0.1)
end
end
end)
task.wait(0.1)
end
end
return WaveHelper
Are you sure that your script can access “EnemyModules[“Brawler Enemy Module”]” in line 8 ?
If i replicate the folders and the modules you are requesting in the script it prints (in the original server script, the one who requires “WaveHelper” ), so it could be a problem with accessing EnemyModules.
This is not sure 100% since i don’t have your exacly folders and modules.