Hello Robloxians, i have come opon a problem with a animal called Ape.
Whenever i try to spawn it through a script instead of it spawning on its feet its spawning in the air sideways.
here is a picture:
here is my code:
local AnimalFolder = game.ServerStorage.Animals
local ape = AnimalFolder.Ape
local destroyTime = 600
local waitDelay = 1
if game.Workspace.Baseplate == nil then
return
end
local newFolder = Instance.new("Folder")
newFolder.Parent = game.Workspace
newFolder.Name = "Workspace.Ape"
local function CreateNewPart()
local NewApe = ape:Clone()
if not newFolder:IsA("Folder") then
return
end
NewApe.Parent = newFolder
local newCFrame = CFrame.new((math.random((-game.Workspace.Baseplate.Size.X / 2), (game.Workspace.Baseplate.Size.X / 2))), 12, (math.random((-game.Workspace.Baseplate.Size.Z / 2), (game.Workspace.Baseplate.Size.Z / 2))))
NewApe:PivotTo(newCFrame)
game.Debris:AddItem(NewApe, destroyTime)
end
local amount = 10
local currentAmount = 0
game.Workspace.ChildAdded:Connect(function(child)
print(child.Name)
end)
newFolder.ChildRemoved:Connect(function(child)
if child.Name == ("Ape") then
currentAmount = currentAmount - 1
end
end)
while true do
if currentAmount < amount then
currentAmount = currentAmount + 1
CreateNewPart()
print(currentAmount)
end
if currentAmount == amount then
print("Ape spawning is at " .. amount .. ". Currently, Ape aren't spawned anymore till Ape is destroyed or deleted.")
end
task.wait(waitDelay)
end
does anybody know how to fix this?