I am trying to script something where when characters are entered into a textbox on a screengui and a button is pressed, then the name of parent's parent of the initial script will be changed to that of the inputted text in the screengui textbox.
script.Parent.Parent.Parent.Parent.Parent.VehicleSeat.TrainGui.Main.Buttons.Delayed.MouseButton1Click:connect(function()
script.Parent.Parent.Name = script.Parent.Parent.Parent.Parent.Parent.VehicleSeat.TrainGui.Main.CBTC.One.Text
print(script.Parent.Parent.Parent.Parent.Parent.VehicleSeat.TrainGui.Main.CBTC.One.Text)
end)
When I put in text into the textbox, it does not change the parent's name.
I received the following outputs:
02:26:23.782 - TrainGui is not a valid member of VehicleSeat
02:26:23.783 - Script 'Workspace.R160 Franklin Av Shuttle.Train.First.Bogey1.DestGlider.CBTC', Line 2
What is the issue?
Note: Line 2 in the output is referring to the Lua provided above.

1 comment
I see what you're saying but the script is inside the part so it renames the parent, so the part (to be renamed) won't have to be found in the script through its actual name, just through the parent.