I had a friend a while back make me a script that would respawn a unit in a mission using a radio command that changes a flag which would then respawn a group into the mission. A while back this script broke and no longer works as it used to. I have no idea about how to use Lua and the friend who made the script also could not figure out as to why it doesn't work anymore. I'd appreciate any help as to why it isn't working.
Respawn Script:
do
function toggleGroup(groupName)
local gp = Group.getByName(groupName)
if mist.groupIsDead(groupName) or not gp:getUnit(1):isActive()
then
mist.message.add({
text = groupName.." Respawned",
displayTime = 5,
msgFor = {coa = {"all"}}
})
mist.respawnGroup(groupName, true)
else
mist.message.add({
text = groupName.." Despawned",
displayTime = 5,
msgFor = {coa = {"all"}}
})
gp:destroy()
end
end
end
For reference this is the error I get:
VKN_Marianas_Training_Mission_Forum.miz