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)
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
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)