of     1   

C_Sharper
#182844006Monday, February 01, 2016 8:56 PM GMT

It works good. But the thing is, it gives me this error after it runs and stops: 'Unable to resume dead coroutine' Is there a fix? Spectate = coroutine.wrap(function() local plrs while script.Parent.Parent.Spectating.Value do print(math.random(1,10)) wait() local plrs = GatherPlayers() if not script.Parent.Parent.Spectating.Value then cam.CameraSubject = p.Character.Humanoid coroutine.yield() end end end) script.Parent.MouseButton1Click:connect(function() game.Players.LocalPlayer.PlayerGui.Assets.Sounds.Click:Stop() game.Players.LocalPlayer.PlayerGui.Assets.Sounds.Click:Play() if not p.Character.Humanoid:FindFirstChild("Alive") then script.Parent.Parent.Spectating.Value = not script.Parent.Parent.Spectating.Value script.Parent.Parent.SpectateFrame.Visible = not script.Parent.Parent.SpectateFrame.Visible if script.Parent.Parent.Spectating.Value then coroutine.resume(Spectate()) end end end)
C_Sharper
#182844372Monday, February 01, 2016 9:03 PM GMT

pls
C_Sharper
#182844540Monday, February 01, 2016 9:06 PM GMT

here lies 62gb's hopes and dreams
powerhotmail123
#182844723Monday, February 01, 2016 9:10 PM GMT

Rather than: coroutine.resume(Spectate()) Try: Spectate(); Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
C_Sharper
#182844816Monday, February 01, 2016 9:12 PM GMT

Thanks!
powerhotmail123
#182844893Monday, February 01, 2016 9:14 PM GMT

Quick thing to note, coroutine.wrap acts as a replacement for both coroutine.create and coroutine.resume. Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
C_Sharper
#182844980Monday, February 01, 2016 9:15 PM GMT

I'll remember that. Though what you suggested gave the same result. 'Cannot resume dead coroutine' I'll give up on coroutines for now. I don't think I really need them for this any way.
LegendaryAccount
#182846272Monday, February 01, 2016 9:36 PM GMT

if your goal is to ever just to create a new thread use spawn(function() end)
ray_revenge
#182846429Monday, February 01, 2016 9:39 PM GMT

spawn() uses coroutines
instawin
#182846617Monday, February 01, 2016 9:42 PM GMT

local function Spectate() local plrs while script.Parent.Parent.Spectating.Value do print(math.random(1,10)) wait() local plrs = GatherPlayers() if not script.Parent.Parent.Spectating.Value then cam.CameraSubject = p.Character.Humanoid coroutine.yield() end end end script.Parent.MouseButton1Click:connect(function() game.Players.LocalPlayer.PlayerGui.Assets.Sounds.Click:Stop() game.Players.LocalPlayer.PlayerGui.Assets.Sounds.Click:Play() if not p.Character.Humanoid:FindFirstChild("Alive") then script.Parent.Parent.Spectating.Value = not script.Parent.Parent.Spectating.Value script.Parent.Parent.SpectateFrame.Visible = not script.Parent.Parent.SpectateFrame.Visible if script.Parent.Parent.Spectating.Value then coroutine.resume(coroutine.create(Spectate)) end end end) would work I believe
instawin
#182846666Monday, February 01, 2016 9:43 PM GMT

And sorry for lack of indentation, modified your script inside of the post
C_Sharper
#182847007Monday, February 01, 2016 9:49 PM GMT

Thanks guys :D

    of     1