I haven’t exactly seen this error too often. You see, I’m trying to run a coroutine:
local RegenCoroutine = coroutine.wrap(function()
SizeReached = true
local Players = FindPlayersInMine()
--teleport all players in the mine outside of the mine
if #Players > 0 then
for _,Player in ipairs(Players) do
local TPs = workspace.MineCore.MineTPs:GetChildren()
Player.Character:SetPrimaryPartCFrame(TPs[RandInt(1,#TPs)].CFrame*CFrame.new(0,3,0))
end
end
workspace.MineCore.MineCover.CanCollide = true
wait(10)
RegenerateCave()
workspace.MineCore.MineCover.CanCollide = false
end)
RegenCoroutine()
However, for some odd reason, after implementing some code completely unrelated to this, I get the error Unable to Cast value to Object.