Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How could I go about spawning certain things at certain waves?

Asked by 4 years ago
if game.ReplicatedStorage.Values.Wave.Value == 2 then
        for i, v in pairs(CS:GetTagged("spawner")) do
        if game.ReplicatedStorage.Values.gameInProgress.Value == true then
            if game.ReplicatedStorage.Values.enemiesRemaining.Value > 0 then
                local NPC = game.ReplicatedStorage.SiegeMachine:Clone()
                NPC.Parent = v
                NPC.HumanoidRootPart.CFrame = v.CFrame
                CS:AddTag(NPC, "enemy")
                game.ReplicatedStorage.Values.enemiesRemaining.Value = game.ReplicatedStorage.Values.enemiesRemaining.Value - 1
            end
        end
end
My current issue at the moment is I want a certain creature to spawn at the second wave but it doesn't seem to activate it. What could I fix to make it to where the creature spawns at the second wave?

1 answer

Log in to vote
0
Answered by 4 years ago

You need to update it with a repeat until function

0
repeat until game.ReplicatedStorage.Values.Wave.Value == 2 this is what im trying to use but it doesnt work? am i doing something wrong with the function? The script is also timing out if that helps with anything? GucciusGangius 2 — 4y
Ad

Answer this question