Can't get this minion script to work

I have a script that is supposed to summon a minion at a position in a boss battle, but i keep getting the “Unable to cast Instance to CoordinateFrame” error, please help me fix this

Heres the script:

function Attack(nothing,andagainnothgi)
wait(3) – this is the cooldown of how much time to wait till they spawn
local minion = game.ReplicatedStorage:WaitForChild(“Goblin”):Clone() – change yourminion to your minion
minion.Parent = script.Parent.Parent.Parent
local spawnl = math.random(1,2) – change 2 to how much spawn locations there are

if spawnl == 1 then
minion:PivotTo(script.Parent.Parent.Parent.spawnlocation1) – same as the top one – change spawnlocation1 to your spawn you want
minion.AI.Enabled = true
elseif spawnl == 2 then
minion:PivotTo(script.Parent.Parent.Parent.spawnlocation2) – same as the top one
minion.AI.Enabled = true
return Attack

You need the data type to be a CoordinateFrame.
Just add .CFrame to get it’s CoordinateFrame. For example:


so this did work, it made the minion appear but when they spawn in they dont move at all and they appear anchored although they arent because this minion was used in a previous battle

1 Like

Doesn’t sound like a problem with that script - probably the script you are using to move them.

Make sure the script you are using to move them:

  • Is enabled
  • Is not a LocalScript
  • Is referencing the new minion and not a model

Also make sure the minion is not anchored.

1 Like