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

When I change the text, it doesn't start?

I have a textbox that when I start out with something other than "Begin1," and then change it to "Begin1," doesn't work. It only works when I press "Test" with the text as "Begin1."

while true do
	
	wait()
	
	if game.StarterGui.Group.TextBox.Text == "Begin1" then

		script.Parent.Text = "Right face!"
		wait(10)
		script.Parent.Text = "Eyes up front!"
		wait(10)
		script.Parent.Text = "Left face!"
		wait(10)
		script.Parent.Text = "Eyes up front!"
		wait(10)
		script.Parent.Text = "About face!"
		wait(10)
		script.Parent.Text = "Eyes up front!"
		wait(10)

	end
end

1 comment

1 answer

Your error is simple. The problem is you are calling on the TextBox that is located in StarterGui, and not the one that is located in your player. The easiest way to fix this, is to just replace StarterGui with the PlayerGui

Here is an example:

local name = "" -- Just put your name here!

while wait() do
	local plr = game.Players:FindFirstChild(name)
	if plr ~= nil then --This just makes sure the player is actually in the game
		local p_gui = plr.PlayerGui -- PlayerGui is the gui for each individual player in the game
		if p_gui ~= nil then
			if p_gui.Group.TextBox.Text == "Begin1" then
				script.Parent.Text = "Right face!"
       			wait(10)
        		script.Parent.Text = "Eyes up front!"
       		 	wait(10)
        		script.Parent.Text = "Left face!"
        		wait(10)
        		script.Parent.Text = "Eyes up front!"
        		wait(10)
        		script.Parent.Text = "About face!"
        		wait(10)
        		script.Parent.Text = "Eyes up front!"
        		wait(10)
			end
		end
	end
end

I hope this helped!

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