For my zombie game i need to make different types of zombies so the game does not get too easy. Also if its possible, config how rare the zombies are. Here is the script : ~~~~~~~~~~~~~~~~~
local CS = game:getService("CollectionService") while true do wait(5) for i, v in pairs(CS:GetTagged("spawner")) do if game.ReplicatedStorage.Values.gameInProgress.Value == true then if game.ReplicatedStorage.Values.zombiesRemaining.Value > 0 then local NPC = game.ReplicatedStorage.Zombie:Clone() NPC.Parent = v NPC.HumanoidRootPart.CFrame = v.CFrame CS:AddTag(NPC, "Zombie") game.ReplicatedStorage.Values.zombiesRemaining.Value = game.ReplicatedStorage.Values.zombiesRemaining.Value - 1 end end end end
~~~~~~~~~~~~~~~~~ What i want is different types of zombies spawning using math.random() also when replying how to do it i need the position.
EDIT: If there are any other ways i can do the other types of zombies and its shorter, ill accept.
I might have an idea:
math.randomseed(tick()) -- Adds a bit more randomness local CS = game:getService("CollectionService") local zombieTypes = [game.ReplicatedStorage.Zombie,game.ReplicatedStorage.Zombie2] -- list of zombies while true do wait(5) for i, v in pairs(CS:GetTagged("spawner")) do if game.ReplicatedStorage.Values.gameInProgress.Value == true then if game.ReplicatedStorage.Values.zombiesRemaining.Value > 0 then local NPC = zombieTypes[math.random(1,#zombieTypes)]:Clone() NPC.Parent = v NPC.HumanoidRootPart.CFrame = v.CFrame CS:AddTag(NPC, "Zombie") game.ReplicatedStorage.Values.zombiesRemaining.Value = game.ReplicatedStorage.Values.zombiesRemaining.Value - 1 end end end end