This script isn't working

One of my scripts weren’t working and i managed to pinpoint it to one spot:

	if not script.Parent.PlayerToFollow.Value == object.Parent.PlayerToFollow.Value then
			print("ok")
			
		else
			print(script.Parent.PlayerToFollow.Value..object.Parent.PlayerToFollow.Value)
		end

For some reason, I haven’t seen a single “ok” in my output, but I’ve seen it print something like Player1Player2, and that should not print since Player1 is NOT Player2. What am I missing?
Also, for some reason indentation is funky on this forum so here’s a screenshot:Screen Shot 2021-08-16 at 10.11.39 AM

could we get a little more info (like, what this is supposed to do?)

if script.Parent.PlayerToFollow.Value == object.Parent.PlayerToFollow.Value then
		print(script.Parent.PlayerToFollow.Value..object.Parent.PlayerToFollow.Value)
		
	else
		print('ok')
	end
1 Like

What is

? We need this info to solve this.

correct me if i’m wrong but wouldnt…

if script.Parent.PlayerToFollow.Value ~= object.Parent.PlayerToFollow.Value

also work? I haven’t ever seen If Not before.

Yes it would work, the main reason people use not (I believe) is to cut down on == nil:

For example:

if not con then
end

Rather than

if con == nil
end
1 Like

dont use not when using == or <=
sometimes it can cause problems (i dont know specifics)
just use ~=

Yep, actually not that I think about it the OP should do this:

Since not is most likely getting checked first.