hello all. I have this script setup and everything is functioning to a dime except for the coroutine i made. basically what I have here is a game that keeps track of your progress and locations discovered, so for example when you step on a ‘finishPart’ it fires a remote event etc. etc. which is all functioning great, except I want it so that when you change screens in the menu, it updates the text on the label to whether it should say complete or not. It doesn’t seme to be functioning, and I have a feeling it’s because I completely incorrectly wrote my coroutines but some of the API is confusing me on them.
for i,v in pairs(mapData) do local changeCompleteStatus = coroutine.create(function() if v.completed == true then sampleFrame.isCompleted.Text = "level "..v.level" has been completed" print("level is complete!") else sampleFrame.isCompleted.Text = "level "..v.level" has not been completed" print("level is not complete") end end) print(v.level) local mapFrame = script.Parent.sampleText:Clone() mapFrame.Visible = not mapFrame.Visible mapFrame.Parent = script.Parent mapFrame.MouseButton1Click:Connect(function() sampleFrame.Visible = true progressMenu.ScrollingFrame.Visible = false coroutine.resume(changeCompleteStatus) sampleFrame.xButton.MouseButton1Click:Connect(function() sampleFrame.Visible = false progressMenu.ScrollingFrame.Visible = true coroutine.resume(changeCompleteStatus) end) end) end