Apparently my string is not == to the other string

Hello! I hope you are having a great day!

I am trying to do == with a string. However, the else is doing the thing and not the thing, even though they are the same.

The code

repeat wait() until game:IsLoaded()

script.Parent.Text = game.ReplicatedStorage.GameSettings:GetAttribute("GameVersion")
if game.ReplicatedStorage.GameSettings:GetAttribute("LatestVersion") == game.ReplicatedStorage.GameSettings:GetAttribute("GameVersion") then
	print("Version up to date")
else
	script.Parent.TextStrokeColor3 = Color3.fromRGB(255, 0, 0)
end

game.ReplicatedStorage.GameSettings:GetAttributeChangedSignal("LatestVersion"):Connect(function()
	if game.ReplicatedStorage.GameSettings:GetAttribute("LatestVersion") == game.ReplicatedStorage.GameSettings:GetAttribute("GameVersion") then
		print("Version up to date")
	else
		script.Parent.TextStrokeColor3 = Color3.fromRGB(255, 0, 0)
	end
end)

The version is set by a Discord webhook.


Proof that they are equal:

image

What is happening:

image
The text is not supposed to outline in red.


If you can help, please let me know. Thanks, WE

Just wanted to know, are you sure it are both string values? Idk but maby there is another text value

They are both strings. The letter v would not be there otherwise.

My question is why do you have two event listeners?

I searched it, but i dont know much about attributes yet, but isnt it possible referring to it as instance.gameversion? Because what i read, is that getattributr returns the attribute itself instead of the value

maybe replace with this

repeat wait() until game:IsLoaded()
local GameSettings = game.ReplicatedStorage.GameSettings
local GameVersion = GameSettings:GetAttribute("GameVersion")
local LatestVersion = GameSettings:GetAttribute("LatestVersion")

script.Parent.Text = GameVersion

if LatestVersion == GameVersion then
	print("Version up to date")
	script.Parent.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
else
	script.Parent.TextStrokeColor3 = Color3.fromRGB(255, 0, 0)
end

GameSettings.AttributeChanged:Connect(function(Attribute)
	if Attribute == "LatestVersion" then
		LatestVersion = GameSettings:GetAttribute("LatestVersion")
	elseif Attribute == "GameVersion" then
		local LatestVersion = GameSettings:GetAttribute("LatestVersion")
	end
	
	if LatestVersion == GameVersion then
		print("Version up to date")
		script.Parent.TextStrokeColor3 = Color3.fromRGB(0, 0, 0)
	else
		script.Parent.TextStrokeColor3 = Color3.fromRGB(255, 0, 0)
	end
end)