~= not working, or is it?

there is a Unselect function, I just didn’t put it in this ex, but its running even tho its not supposed to

local Button = script.parent
local Name = script.parent.Name
local COOLDOWN = false
local Selected = script.parent.Selected
local function Select()
	
	if Selected.Value ~= nil then
	
	
		Unselect() -- still runs event tho Selected is nil or nothing
	end
		
		if Selected.Value ~= Name then
			
		Button.TextTransparency = 0
		Selected.Value = Name
	end
end

Button.MouseButton1Up:Connect(function()

	if COOLDOWN == false then
	
		
	Select()
	
wait(0.3)

	COOLDOWN = true	
		

	

end
end)

You’re checking if it is NOT selected and if it isn’t then unselect it?? Shoudln’t you check if it is selected?

You could try setting a breakpoint in your code and step through it line by line to see what it’s doing and what the variables are.

Your script is kinda wrong about the 1st 5 lines. Try using Parent instead of parent

local Button = script.Parent
local Name = script.Parent.Name
local COOLDOWN = false
local Selected = script.Parent.Selected
local function Select()
	
	if Selected.Value ~= nil then
	
	
		Unselect() -- still runs event tho Selected is nil or nothing
	end
		
		if Selected.Value ~= Name then
			
		Button.TextTransparency = 0
		Selected.Value = Name
	end
end

Button.MouseButton1Up:Connect(function()

	if COOLDOWN == false then
	
		
	Select()
	
wait(0.3)

	COOLDOWN = true	
		

	

end
end)

No , I do have that In the real script, I would have noticed it in the output if that would have been the case

but the point is that selected.value is nothing , still runs the unselect even tho its not supposed to tho?

Is selected a StringValue? The type doesn’t matter actually, but no ??Value instance can have the value nil. What do you store there? Literally the string "nothing"? Or the integer 0 if it’s an IntValue?

String value it is, I have not set the value to anything

In that case you should check it this way:
Selected.Value ~= ""

So strings don’t use nil for nothing?

No that’s not what I meant. I meant StringValues can’t hold the value nil (AFAIK), not that variables previously holding a string can’t be assigned nil afterwards.

So the default isn’t nil, Thanks I didn’t find about this until now,

A newly instantiated ‘StringValue’ object has an empty string literal assigned to its ‘Value’ property.

You can verify this by performing the following.

local s = Instance.new("StringValue")
print(type(s.Value), string.len(s.Value)) --string 0