Equality Error (Two Objects)

Hi! I am try to make a starter menu for a roblox game I am working on. But when I run the game, the output gives me this error: Syntax Error: (17,41) Expected identifier when parsing expression, got '=' I have tried using the logical operator “==” instead but that did not work either. This is my code:

local button = script.Parent

button.MouseButton1Click:Connect(function()
	local gradience = button:WaitForChild("Gradience")
	local chosengradience = button.Folder:WaitForChild("ChosenGradience")
	local chosen = button.Chosen.Value
	local category = button.Category.Value
	local current = button.Parent.Current.Value
	
	for i, v in pairs(button.Parent:GetChildren()) do
		if v.ClassName == "TextButton" then
			if v.Name ~= "Continue" then
				if v:WaitForChild("Category").Value == category then
					if v:WaitForChild("Chosen").Value == true then
						v:WaitForChild("Chosen").Value = false
						v:WaitForChild("Folder"):WaitForChild("Gradience").Parent = v
						v:WaitForChild("ChosenGradience") = v:WaitForChild("Folder")
						current = button.Name
					end
				end
			end
		end
	end
	gradience.Parent = chosengradience.Parent
	chosengradience.Parent = button
end)

If it’s possible, could you please explain why I got an error and how I can fix it? Thanks, and have a great day!

Which line is the error occurring on I can’t seem to find it.

if v:IsA("TextButton") then
if v:WaitForChild("Chosen").Value then

srry meant i deleted the post
anyways the error is on line 17

Is it on the line 18 of this post?

the error seems to be in: if v.ClassName == "TextButton" then
you must use the command isa

is it on line 17 of this post^

no, line 17 is where the error occurs

v:WaitForChild("ChosenGradience") = v:WaitForChild("Folder")

You’re apparently setting an object to another object, e.g v.ChosenGradience = v.Folder?

1 Like

because he always says it before i say it?

Yeah I’m aware I’m trying to find the line in this post

oh, i didnt see that, mb (30 limits)

1 Like

I would rather say that the command is:IsA

although this is a good change to make, its not the cause of this error

meant v:(something).Parent = v.something

1 Like

is a error but you have to analyze it What if you make more variables or put a different name to the folder?

it clumps the text less than if you didnt but doesnt do anything significant really

1 Like

im going to complain about another issue im having, have a nice day :slight_smile:

I’m going to Provide Code Simplification however:

button.Activated:Connect(function()
    -- rest of code
    local Array = button.Parent:GetChildren()
    for i,v in Array do
        if v:IsA("TextButton") and v.Name ~= "Continue") then
            if v.Category.Value then
                 v.Category.Value = false
                 -- rest of code
            end
        end
    end
end)

not related to any errors or anything just to clarify