Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I put a function inside a coroutine?

Asked by 9 years ago

I have a script that looks like this:

local newThread = coroutine.create(function()
    while wait() do
        if game.Workspace.Part.Transparency == 1 then
        game.Workspace.Part.Transparency = 0
    end
end)

coroutine.resume(newThread)

-- there is more code down here, but it's not important for this question.

What I want to do is to change the while true do loop into a Changed function, but I'm not sure how I would put a function inside of a coroutine. Can anyone tell me how to do this?

Answer this question