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

MouseButton1Click wont work more than once?

I am making an Admin GUI and I have made it so once you type in a username and click Search then that username is put on another text box in the information GUI.

The issue is that it works one time however once I write another username and click Search, it doesn't work? Can someone please help?

The code in TextButton:

local player = script.Parent.Parent.Parent.Parent.TextBox.TextBox_Roundify_12px.TextBox.Text
local frame2 = script.Parent.Parent.Parent.Parent.Parent.Info

function searching()
	frame2.Username.Text = player
end

script.Parent.MouseButton1Click:Connect(searching)

1 answer

✓ Accepted answer

Whats happening is that you're only setting the variable player once, so it won't change the next time you type into it.

local frame2 = script.Parent.Parent.Parent.Parent.Parent.Info

function searching()
	local player = script.Parent.Parent.Parent.Parent.TextBox.TextBox_Roundify_12px.TextBox.Text
	frame2.Username.Text = player
end

script.Parent.MouseButton1Click:Connect(searching)

Doing this should update the player variable every time you press the button.

1 comment

0

Thank you this worked! Much appreciated!

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