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

Executing a script using specific text from TextBox?

I'm making an admin gui (not that skilled at scripting lol)

its basically gonna be a TextBox and you type in a bunch of commands, I thought I can do the commands like this:

if Command.Text == "cmds" then -- Command.Text is the TextBox where you type commands in
commands.Visible = true -- There's a seperate gui with a list of commands
end

and when I put in "cmds" in the textbox, it would run the script, but nothin happens and nothing prints in output.

It's probably super easy, and I'm probably doing this really wrong. I literally have all the commands set up as this so if someone told me the fix that would help a lot lmao

1 answer

✓ Accepted answer

It's because you called this immediately when the text wasn't "cmds". You need to have an event to be called every time the text is modified.

Command.Changed:Connect(function(Change)
	if Command.Text == "cmds" then
		commands.Visible = true
	end if
end)

2 comments

0

What does "end if" mean in line 4? Wouldn't it just be "end"? Also, can I use this with elseif, to include all the commands in one function? Or would I need to repeat that function for every command?

0

No need to make a new function for every command, you can just write "elseif Command.Text == "SomethingElse" then"

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