If statement won't run even if a certain condition is met

Hello, I am trying to make a badge system that awards a badge if the text matches a supplied text…

I am using a GUI for this, and a remote event. If I use the remote event without any if statements, it will run the entire event smoothly. What I am doing is having if statements (securing the remote), but if it is ran, it will not get past, even tho it meets the certain codition.

Explorer:

image

Localscript:

script.Parent.FocusLost:Connect(function()
	local plr = game.Players.LocalPlayer
	local inp = script.Parent.Text 
	
	if inp == "3142022.Dis" then
			script:WaitForChild("Replicator"):FireServer(plr.UserId, script.Parent)
		elseif inp == "TheRealRealtor.Dis/Home"  then
			print("y")
		elseif inp == "TheRealRealtor.Dis/Houses" then
			print("e")
		else 
			script.Parent.Parent.Parent.Error.Visible = true
	end
end)

Server Script:

script.Parent.OnServerEvent:Connect(function(plr, userID)
	if script.Parent.Parent.Parent.Text == "3142022.Dis" then
		game:GetService("BadgeService"):AwardBadge(userID, 2126179821)
		print('got thru')
	end
end)

Any ideas?

You should really be sending inp through the remote event and checking that the passed inp value is correct.

I’m assuming the issue is because you change text locally, so the server can’t see it.

Just send the inp here.
script:WaitForChild("Replicator"):FireServer(inp)

And in server script do this:

script.Parent.OnServerEvent:Connect(function(plr, inp)
	if inp == "3142022.Dis" then
		game:GetService("BadgeService"):AwardBadge(plr.UserId, 2126179821)
		print('got thru')
	end
end)

Here’s a little information from a post I made a while back.

I’ve tried that as a solution, it returned the same results, no fix.

the problem is

when the player types into textbox
the textbox.Text does not replicate to the server so the server cant see what the textbox.Text is

so you have to send the text in the event

-- Localscript

local remoteEvent = script:WaitForChild("Replicator")
remoteEvent:FireServer(inp)
-- server Script
local remoteEvent = script.Parent
remoteEvent.OnServerEvent:Connect(function(player, text)
    print(player.UserId, "Sent", text)
    if text == "3142022.Dis" then
        print('got thru')
    end
end)