Need help with lines of code running, when they're not meant to

You can write your topic however you want, but you need to answer these questions:
I’m trying to make a custom keybinds system where it can check for duplicates. If it detects a duplicate it shouldn’t show a text saying “Saved”, although in the screenshot, where it is highlighted, does run.

Any help is appreciated!

Try putting this print function in that if statement and see if it’s get outputted.

for i, v in pairs(keychn) do
	if v.Value == ttc3 then
		print("OHNO")
		return
	end
end

Yep. It does.

typing
typing
typing

It just magically fixed itself :thinking:

Nevermind, I’ve run into another issue. I’ve tried to make a piece of text show up with it, and now the text shows with the “Saved” text if it doesn’t find a duplicate.

So, even though the “OHNO” doesn’t get printed, the Dup.Visible still become true along with the Saved text? Or am I misunderstanding this.

The issue is that everything in that “if v.Value == ttc3” area gets run, while everything else gets run too.

Example: v ~= ttc3 Dup.Visible becomes true, Saved.Visible becomes true.

I speculate that you may have another script that is disturbing this process. Perhaps try disabling all other scripts except this one and test again?