Script.parent doesn't work

Hello, i’m trying to make custom GUI while teleporting to other place and i set local telgui as correct path using script.parent… however roblox keeps saying it’s wrong path (ignoring fact it’s correct path!) 2 devs from game tryed to set path again and it kept saying it’s wrong path. We tryed to set path from play mode from player… didn’t work!

CODE:
local telgui = script.Parent.Parent.Parent.Connecting

White: Script
Red: GUI I’m trying to get using script.parent…
image

1 Like

Try getting the path with:
game.Players.LocalPlayer.PlayerGui.["restofpath"].Connecting

1 Like

Very odd. Maybe you’re typing something wrong. I’ve never experienced this problem

1 Like

As i said everything in there is correct (few people tryed it)

1 Like

Is the picture of the starterpack? It’s zoomed in a bit too much.

StarterGUI However tryed in play mode and using that auto fill it says everything is okay (even suggests it when i type Cone…)

Did you try calling the path from LocalPlayer.PlayerGui?

Use WaitForChild("Connecting"), so:

local telgui = script.Parent.Parent.Parent:WaitForChild("Connecting")

The reason you use WaitForChild is that sometimes, using a local script to define anything that is not an ancestor of the local script, isn’t loaded in yet, so it will return nil, and therefore wouldn’t work.

1 Like

Tryed, even autosuggests it (30 chars)

Weird, try print(script.Parent.Parent.Parent.Connecting.Name)

You probably didn’t do this, but to make sure every possibility is looked at: do you change telgui at any other point? Or use the wrong spelling when using telgui? Could we see the full script?

Works! But it’s really odd it haves correct path