Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with Gui?

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)

2 comments

1

The error is: TypeHere is not a valid member of ScreenGui

1

This was caused on line 3

1 answer

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

4 comments

0

Where are other variables?

0

This is an answer, not request site. I answered your question, I din't need to put in the variables. That script was an example (that you can copy)

0

I never requested. I asked you and you never answered..

0

This is simply meant as a demonstration, I don't need the variables. Sorry if you interpreted wrong.

This discussion is preserved as it was. New answers, comments, and votes are closed.