Plugin cloning twice when I edit parent in script to coregui

I have been having this issue when I change the parent of a screen gui to core GUI it makes 2 copies so there is 2 screenguis of the same thing in coregui. This is messing up a lot of stuff. Any help is great! Thanks! Code Below:

local Toolbar = plugin:CreateToolbar("name") 
local Button = Toolbar:CreateButton("name", "name", "", "name") 
local CoreGui = game:GetService("CoreGui")

local mainscreen = script.Parent
mainscreen.Parent =  CoreGui
mainscreen.Enabled = true
main.NotificationUIText.Visible = true
main.NotificationUIText.Text1.TextTransparency = 1
main.NotificationUIText.Text2.TextTransparency = 1
	mainscreen.Enabled = not mainscreen.Enabled