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

How do I make a gui give a certain player clothes depending on a string value?

So I was making this gui and I wanted to make it where it gives the player from a stringvalue the clothes depending on what the player with the gui put in the TextBox. The stringvalue get's its value from the TextBox so let's say I entered "Spar_Kled" into the TextBox that would then become the value of the stringvalue (I have a script where it automatically updates the value everytime a new text is entered in the TextBox, and yes I checked to see if it works and it does)

This is the script in the TextButton https://gyazo.com/3d8bcab312e9f4674f761d4bf76ba6fe

And these are all the things inside the MainGui https://gyazo.com/9ea0bc27e1b246c2fe1a1ca80267bf17

1 answer

local phrases = {"booya","chicken","groceries"}
local textbox = (wherever your textbox is)

textbox.FocusLost:Connect(function(enter, key)
	if enter then
		local currenttext = textbox.Text
		for i,v in ipairs(phrases) do
			if currenttext == v then
				-- give players things or whatever.
				print("yay!")
			end
		end
	end
end)

or if you wanna do something different for each phrase

local phrases = {"booya","chicken","groceries"}
local textbox = (wherever your textbox is)

textbox.FocusLost:Connect(function(enter, key)
	if enter then
		local currenttext = textbox.Text
		for i,v in ipairs(phrases) do
			if currenttext == "booya" then
				-- give players things or whatever.
				print("yay!")
			elseif currenttext == "chicken" then
				-- give players more things.
				print("wooo!")
			end
		end
	end
end)

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