Hey, i'm trying to make a 'summoner' weapon. When activated, clones a minion into workspace and follows the player. It works, but when i unequip the tool, they stop moving. How would i make it so the minion moves in the background?
tool.Equipped:connect(function()
tool.Activated:connect(function()
if enabled == false and tool.Parent:FindFirstChild("Humanoid") and tool.Parent:FindFirstChild("Humanoid").Health > 0 then
enabled = true
local cloneminion = minion:Clone()
cloneminion.Name = tool.Parent.Name
cloneminion.PrimaryPart = cloneminion:FindFirstChild("CenterPart")
wait(0.1)
cloneminion:SetPrimaryPartCFrame(tool.Parent.UpperTorso.CFrame)
cloneminion.Parent = workspace:FindFirstChild("MinionModel")
local thread = coroutine.create(MinionControl)
coroutine.resume(thread, cloneminion, game.Players:FindFirstChild(cloneminion.Name))
wait(cooldown.Value)
enabled = false
end
end)
end)

2 comments
I recommend, if you haven't to look at the WIKI docu: http://wiki.roblox.com/index.php?title=Global_namespace/Coroutine_manipulation Although, I suggest using spawn over using the coroutines: http://wiki.roblox.com/index.php?title=Global_namespace/Functions_specific_to_ROBLOX#spawn It's a coroutine itself, but w/o all the annoying typing.
I replaced the coroutines with this 'spawn(function() MinionControl(cloneminion, game.Players:FindFirstChild(cloneminion.Name)) end)' but the minion still freezes after i unequip the weapon