I am trying to move my enemy in a module script to a position called by a function: `local enemy = {}
local details = require(script.EnemyDetails)
local enemies = script.Parent.Enemies
enemy.spawnEnemy = function(enemy, pos)
task.wait(0.1)
script.Parent.Enemies[enemy].Parent = workspace
print(pos)
enemy:SetPrimaryPartCFrame(pos)
local eyes = Instance.new("Decal")
eyes.Parent = enemy.FacePart
eyes.Texture = details.getRandomEye()
print(eyes.Texture)
local mouth = Instance.new("Decal")
mouth.Parent = enemy.FacePart
mouth.Texture = details.getRandomMouth()
print(mouth.Texture)
enemy:WaitForChild("Humanoid").Died:Connect(function()
--details.getRandomDeath()
local sound = Instance.new("Sound")
sound.Parent = enemy.Head
sound.SoundId = details.getRandomDeath()
sound:Play()
end)
end
return enemy`
and I input this for the function calling: `local enemy = require(script.Enemy)
for i = 0, 10 do
enemy.spawnEnemy(“Devil”, workspace.Spawn.CFrame)
end`
and I get this error: 16:02:52.515 ServerScriptService.Enemies.EnemyHandler.Enemy:11: attempt to call missing method 'SetPrimaryPartCFrame' of string - Server - Enemy:11
Why?