script.Parent giving different results?

I’m using script.Parent.Parent.Parent in both print and the function but for the print its the player gui and for the function its a child of the gui, why?

image

oh also I forgot, here’s the noise thing in the hierarchy
image

what is in image lable? it has an arrow next to it

image
I don’t think it has anything to do with the parent though

First of all, use a local script for GUI stuff
Second of all, just use this function

local function updatecamera()
     print(script.Parent.Parent)
     script.Parent.Parent.Enabled = true

This should work because the script.Parent.Parent is noise so no need to do the extra parent and then try to access the child

script.Parent.Parent is not noise, it’s a different instance
here’s my startergui hierarchy, MainFrameScript is the one I’m referencing
image

Where are you calling update camera?

in MainFrameScript and in CameraHandler but it works fine in CameraHandler

what is in the camera holder script?

Because when the Player joins the game, the UI gets sent to PlayerGui from StarterGui, StarterGui is the Gui the Player will start with. PlayerGui is what the Player would see. And use on their screen.

1 Like

I came up with a solution, just replace script.Parent.Parent.Parent with LocalPlayer.PlayerGui and it works fine lol

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.