These are doors for spawners, but over time, they get bugged . They spawn zombies but even on the first wave, they somehow fly out despite not being selected twice in a row. Is it just me or is tweenservice bugged?
Code that creates tweens + first wave of spawning enemies (do note that the spawners go into the ground which counts as opening)
local function getspawn(npcchosen)
if npcchosen.Humanoid.Health < (20000 * game.ServerStorage.Values.DifficultyHealth.Value) then -- normal zombie spawn
local randomspawn = math.random(1,20)
local base = game.Workspace.AttackerBase
if randomspawn == 1 then
npcspawn = base["Zombie Spawner1"]
end
if randomspawn == 2 then
npcspawn = base["Zombie Spawner2"]
end
if randomspawn == 3 then
npcspawn = base["Zombie Spawner3"]
end
if randomspawn == 4 then
npcspawn = base["Zombie Spawner4"]
end
if randomspawn == 5 then
npcspawn = base["Zombie Spawner5"]
end
if randomspawn == 6 then
npcspawn = base["Zombie Spawner6"]
end
if randomspawn == 7 then
npcspawn = base["Zombie Spawner7"]
end
if randomspawn == 8 then
npcspawn = base["Zombie Spawner8"]
end
if randomspawn == 9 then
npcspawn = base["Zombie Spawner9"]
end
if randomspawn == 10 then
npcspawn = base["Zombie Spawner10"]
end
if randomspawn == 11 then
npcspawn = base["Zombie Spawner11"]
end
if randomspawn == 12 then
npcspawn = base["Zombie Spawner12"]
end
if randomspawn == 13 then
npcspawn = base["Zombie Spawner13"]
end
if randomspawn == 14 then
npcspawn = base["Zombie Spawner14"]
end
if randomspawn == 15 then
npcspawn = base["Zombie Spawner15"]
end
if randomspawn == 16 then
npcspawn = base["Zombie Spawner16"]
end
if randomspawn == 17 then
npcspawn = base["Zombie Spawner17"]
end
if randomspawn == 18 then
npcspawn = base["Zombie Spawner18"]
end
if randomspawn == 19 then
npcspawn = base["Zombie Spawner19"]
end
if randomspawn == 20 then
npcspawn = base["Zombie Spawner20"]
end
if npcspawn ~= nil then
npcchosen.Parent = workspace.AttackerNpc
npcchosen:MoveTo(npcspawn.PrimaryPart.Position)
print(npcspawn:GetFullName())
local tween = tweenserve:Create(npcspawn.door,TweenInfo.new(0.5),{
Position = npcspawn.door.Position - Vector3.new(0,8,0)} )--open
local tween2 = tweenserve:Create(npcspawn.door,TweenInfo.new(0.5),{
Position = npcspawn.door.Position + Vector3.new(0,8,0)}) -- close
tween:Play()
print("Opening:"..npcspawn.Name)
tween.Completed:Connect(function()
wait(1)
print("Closing:"..npcspawn.Name)
tween2:Play()
end)
end
else -- mini boss or boss spawn
local randomspawn = math.random(1,4)
local base = workspace.AttackerBase
if randomspawn == 1 then
npcspawn = base["Special Zombie Spawner1"]
end
if randomspawn == 2 then
npcspawn = base["Special Zombie Spawner2"]
end
if randomspawn == 3 then
npcspawn = base["Special Zombie Spawner3"]
end
if randomspawn == 4 then
npcspawn = base["Special Zombie Spawner4"]
end
npcchosen.Parent = workspace.AttackerNpc
npcchosen:MoveTo(npcspawn.PrimaryPart.Position)
end
end
values.Wave.Changed:Connect(function(newwave)
if game.ServerStorage.Values.WaveInProgress.Value == false then values.WaveInProgress.Value = true
game.ReplicatedStorage.Values.Wave.Value = newwave
game.ReplicatedStorage.Events.PlayerEvent:FireAllClients("Dialogue","Wave "..newwave.." starting")
if newwave == 1 then -- wave 1
for count = 1,30 * values.SpawnMultiplier.Value do
local chance = math.random(1,3)
if chance == 1 then
local soldierc = units["Demonic Soldier"]:Clone()
npcchosen = soldierc
end
if chance == 2 then
local demonc = units.Demon:Clone()
npcchosen = demonc
end
if chance == 3 then
local swordierc = units["Demonic Swordier"]:Clone()
npcchosen = swordierc
end
getspawn(npcchosen)
wait(3)
end
wait(30)
end
end
end
When the first wave starts, time between spawning zombies are 3 seconds, yet both tweens start and end in one second. I even ensured the same spawner was not chosen twice in a row