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

Spawning in a zombie?

Asked by 8 years ago

Hey, I'm trying to clone a zombie, then place it in a place in the room. The original is in ReplicatedStorage. However, unless the Torso is anchored, the clone will only spawn at the original's position. Even if I try to set the anchored to false after setting the position, the moment the Torso is no longer anchored, it teleports back to the original position. ~~~~~~~~~~~~~~~~~ wait(10) local numMonsters = math.random(1, 10) for i = 1, numMonsters, 1 do local clone = game.Workspace["Drooling Zombie"]:Clone() local room = script.Parent local x = room.PositionIndicator.Position.X local z = room.PositionIndicator.Position.Z local newX = math.random(0, 25) local newZ = math.random(0, 25) clone.Torso.CFrame = CFrame.new(Vector3.new(x + newX, 10, z + newZ)) clone.Parent = game.Workspace

    wait(1)

end

~~~~~~~~~~~~~~~~~

The script makes a clone, sets it to a random position relative to the room's center, and puts it into the Workspace.

Answer this question