Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't this Coroutine Function working for me, it's asking for ')'?

This is the error:

21:17:06.184 - Players.Player.PlayerGui.Chat_GUI.Player_Chat:26: ')' expected (to close '(' at line 16) near 'end'

The script:

local PushMessages = coroutine.create(function(Size)
	for i,v in pairs(C)do
		print(v);
		v.Position = v.Position - UDim2.new(0,0,0,Size)
		if v.Position.Y.Offset < -ChatFrame.AbsoluteSize.Y then
			C[i] = nil
			v:Destroy() 
		end
	end
end
end)  -- <------------------------------------------------- See that ')' it's erroring even if I don't haVe it.

On the wiki there is this example:

local newThread = coroutine.wrap(function(a, b, c)
    print(a * b + c)
end)
 
newThread(8,2,1)

I tried to replicate the format, but it's not working.

Help!!!

1 answer

✓ Accepted answer

It seems that you have an extra end on line 10. Try this:

local PushMessages = coroutine.create(function(Size)
    for i,v in pairs(C)do
        print(v);
        v.Position = v.Position - UDim2.new(0,0,0,Size)
        if v.Position.Y.Offset < -ChatFrame.AbsoluteSize.Y then
            C[i] = nil
            v:Destroy() 
        end
    end
end) 

-- And then you would use PushMessages() to call it.

Hope this helped.

2 comments

0

Thanks a lot, fixed some of the errors and now it starts-up fine although needs a bit tweaking but fixed this specific problem!

0

No problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.