Issue with parenting

I am having this error:

The Parent property of BoxGradient is locked, current parent: NULL, new parent B - Client - Menu:45**



local MenuUI = Plr.PlayerGui:WaitForChild("Menu")	
local Main = MenuUI.Main
local Glow = RepStorage.Glow
local BoxGr = RepStorage.BoxGradient

local Frames = {
	Main.A,
	Main.B, 
	Main.C,
	Main.D,
	Main.E,
	Main.F
}

for _, Frame in pairs(Frames) do
	Frame:FindFirstChildWhichIsA("TextButton").MouseEnter:Connect(function()
		
		local BoxGrNew = BoxGr:Clone()
		BoxGr.Parent = Frame
		BoxGr.BackgroundColor3 = Frame:FindFirstChildWhichIsA("TextButton").TextColor3
		
		local Glow = Glow:Clone()
		Glow.Parent = Frame
		Glow.ImageColor3 = Frame:FindFirstChildWhichIsA("TextButton").TextColor3
		Glow.Position = UDim2.new(0, Frame.AbsolutePosition.X, 0, Frame.AbsolutePosition.Y)  
		Glow.ImageTransparency = .7
		
		--TweenService:Create(Frame.Glow, TweenInfo.new(.2), {ImageTransparency = .7}):Play()
		TweenService:Create(Frame.BoxGradient.UIGradient, TweenInfo.new(.4), {Offset = Vector2.new(0, 0)}):Play()
	end)
	Frame:FindFirstChildWhichIsA("TextButton").MouseLeave:Connect(function()
		Frame.Glow:Destroy()
		Frame.BoxGradient:Destroy()
	end)
end

i am aware what the error means but i havent been able to fix it. Any help would be awesome :money_mouth_face:

The error is on line 45, you only gave us 37 lines.

the other part is cut off but its ok. i posted this after 10 minutes of not being able to solve the problem only to realize right now that the issue is a mispelling. sorry for wasting your time lol

1 Like

Please mark your post above as the solution, otherwise people are going to keep responding to it to try and solve it.

1 Like