Frame not moving and other frame not becoming visible

I’m trying to get my script to make the main frame visible after moving the frame of where the script is coming from. The code that I’m using right now is

local mainFrame = script.Parent.Parent.Parent.Parent.Parent.Parent.Main
local mainEmail = script.Parent.Parent
mainEmail.Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.Emails.Email_Frame:FindFirstChild(script.Parent.Parent.ID.Value)
mainFrame.Visible = true
mainEmail.Visible = false

There’s no errors in the code at all, so I’m not sure what to do

You have a ton of ".Parent"s that it is easy to get lost on which object your script is referring to. I would advise making the script a child of the largest or ‘oldest’ parent and then adjusting from there. When testing, check if any of the other frames are visible. If so, then you can diagnose your problem and work from there.

Is it a local Script and Also Please use Variables and show screenshot of Startergui.

Fixed it, thanks for the help on this