Code:
local NPC = game.ReplicatedStorage[“Zombie”]
local Spawner = script.Parent
while true do
local Clone = NPC: Clone()
Clone.UpperTorso.CFrame = Spawner.CFrame
Clone.Parent = workspace
wait(5)
end
i put that script in the baseplate but zombies are only spawning were they were before i putted them in the replicated storage. is there a way i can make the code spawn zombies different places and not on the same place?
They’re not spawning in since I don’t think you should make a space between NPC and Clone
Try removing the space between NPC: Clone()
So the script should look like this:
local NPC = game.ReplicatedStorage.zombie
local Spawner = script.Parent
while true do
local Clone = NPC:Clone()
Clone.HumanoidRootPart.CFrame = CFrame.new(X, Y, Z) – Replace X,Y,Z with your cords
Clone.Parent = game.workspace
wait(5)
end
if you are gonna use free model and give up getting help then you wont be able to learn scripting and you wont improve in it
try this one i will explain you how the Cframe works:
local NPC = game.ReplicatedStorage.zombie
local Spawner = script.Parent
while true do
local Clone = NPC:Clone()
Clone.HumanoidRootPart.CFrame = Spawner.CFrame * CFrame.new(math.random(1,10),(math.random(1,10),(math.random(1,10))
Clone.Parent = game.workspace
wait(5)
end
we used this sign * so that it plus the spawner position which mean it will get a random number between 1 and 10 and the random number is 6. then if the spawner position is 9,0,1 then it will be 15, 6, 7 which mean the Clone will be in that position