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

When I enter text inside a textbox and click imagebutton to confirm it, it does not work? [SOLVED]

So when I enter text inside this textbox, I have an imagebutton that acts as a checkmark that will be clicked to see if the answer is correct or not, but even though the answer is correct, the answer being "Socrates", it still does not respond.

Here is the code

local gui = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Arro1
local text = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.TextLabel
local two = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.two
local box = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.TextBox
local checkmark = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.ImageButton

local answer = "Socrates"

if answer == box.Text then
	checkmark.MouseButton1Click:Connect(function()
		two.Visible = false
	end)
end

1 answer

✓ Accepted answer
local gui = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Arro1
local text = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.TextLabel
local two = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.two
local box = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.TextBox
local checkmark = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.ImageButton

local answer = "Socrates"

box.Changed:Connect(function( ... )
		if box.Text == answer then
	    checkmark.MouseButton1Click:Connect(function()
        two.Visible = false
    		end)
		end
	end
end)

2 comments

0

I appreciate this, thank you!

0

Your welcome :)

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