I know how to get all parents but when I click on the "Enter" button, it shows the text if its success of a failure in STUDIO mode. If I am in a real server, the text does not come up.
--//Variables player = game.Players.LocalPlayer TypeHere = player.PlayerGui.CodeGui.TypeHere Enter = player.PlayerGui.CodeGui.Enter Weapon = game.Lighting.Weapon --Whatever name you want the item to be that is in lighting --//Function Enter.MouseButton1Click:connect(function() if TypeHere.Text == "youtube" then --"youtube" is the code they need to put in so they can get the item in Lighting Enter.Text = "Success" Weapon.Parent = player.Backpack else Enter.Text = "Failure" end end)
TypeHere was the error, as listed by PickUpTheBeat1 in the comments.
To make it work better:
local gui = player.PlayerGui:FindFirstChild("CodeGui") local TypeHere = nil if gui then TypeHere = gui:FindFirstChild("TypeHere") end Enter.MouseButton1Click:connect(function() if TypeHere then if TypeHere.Text == "youtube" then --code end end end)
Also, if there's an error in the output about something being nil (and that something isn't nil, and you have done everything right), a change of search can fix it. E.g:
game.Workspace -- doesn't work game["Workspace"] -- works