#Creating Enemy with "Spawner" makes model offset

5 messages · Page 1 of 1 (latest)

limpid verge
#

Hi there, im still pretty new to scripting area, so im trying to learn now the Enemy areas.
My problem is here, when i create enemy in workspace. its looks pretty good, and its works pretty good too, but i dont want to create every location with this enemy, instead i would like to use "enemyspawner" where they will spawn on the part.

My problem here is: The model is somehow offset when its spawn?

#
local enemys = workspace.Enemy:GetChildren()
local enemeyModel = game:GetService("ReplicatedStorage"):WaitForChild("Enemy")

for _,enemy in pairs(enemys) do
    print(enemy.Position)
    local enemyM = enemeyModel:Clone()
    enemyM.Parent = workspace
    enemyM.PrimaryPart.Position = Vector3.new(enemy.Position)
    --enemy:Destroy()
end

This is how i spawn thoses enemys.

hexed vortex
#

Do you still need help?

#

If you do, instead of
enemyM.primarypart.position
do this
enemyM:PivotTo(enemy.CFrame)