I have been trying to set a variable using GUI Adornee’s Parent. (SurfaceGui.Adornee.Parent). The Adornee is set in the GUI, it refers to a part in Workspace. Though, the script after it wont work and F9 prints that its value is "nil", even though that the value obviously shouldn’t be nil.
I don’t know how to fix this issue, neither could find any help anywhere.
I misread your post, I thought you were saying that SurfaceGui.Adornee.Parent was nil.
The probably means somewhere along the line the Adornee is getting set back to nil.
This is the whole code. (For context, it’s basically a TextBox that enables a ProximityPrompt, if you enter the correct Text)
local PASSWORD = "32$EKIRTS!312"
local SurfaceGUI = script.Parent.Parent.Parent
warn("SurfaceGUI.Adornee value")
print(SurfaceGUI.Adornee)
warn("SurfaceGUI.Adornee.Parent value")
print(SurfaceGUI.Adornee.Parent)
warn("SurfaceGUI.Adornee.Parent.Parent.Parent value")
print(SurfaceGUI.Adornee.Parent.Parent.Parent)
local HackingTables = SurfaceGUI.Adornee.Parent.Parent.Parent
local InsideMonitor = HackingTables:WaitForChild("HackingTableInside")
local Core = InsideMonitor:WaitForChild("Core")
local ProximityPrompt = Core:WaitForChild("ProximityPrompt")
warn("BEFORE TEXTBOX")
local TextBox = script.Parent
warn("BEFORE FOCUS LOST")
TextBox.FocusLost:Connect(function(enterPressed)
warn("FOCUS LOST")
if enterPressed then
local Text = TextBox.Text
if Text == PASSWORD then
print("CORRECT PASSWORD")
ProximityPrompt.Enabled = true
else
print("WRONG PASSWORD")
end
end
end)
If I’m right, only the warn("SurfaceGUI.Adornee value") and print(SurfaceGUI.Adornee) get printed. The print function returns nil, as mentioned already. (I used the warn function as a comment in F9, basically.)
Is the SurfaceGui in StarterGui or in the part that it’s adorned to? (Just curious if it’s just getting unset by something on the Roblox side and needs to be set again after the game loads.)