How to prevent plugin from erroring in playtest

So how would I prevent an error from occuring due to my plugin when playtesting, I have this code here:

plugin:CreateToolbar("new plugin")

This won’t work in playtesting so what should I do to prevent this error from occuring in playtesting?

Since the script isn’t being run in the context of a plugin, of course the plugin variable is nil. Although, what is this for? Plugins aren’t really meant for use during a play test but while you are editing.

I know but when I download the plugin it won’t error?

Yes because you are running it as a plugin