Roblox attributes cant == equal a value idk what im doing wrong Please help

so if you look at the script childstats is a value in the workspace and child child:GetAttribute(“character”) = 1

local childstats = game.Worlspace.childstats
childstats.Value = 1
if childstats.Value == child:GetAttribute(“character”) then
wait()
child.Owned.Text = “Equiped”
child.Owned.TextColor3 = Color3.fromRGB(255, 255, 0)
child.Owned.Visible = true

		end

In order to set an attribute to a certain value, use the :SetAttribute() function on the instance. Replace the first line of the code you provided with child:SetAttribute("character", 1). That should fix your issue.

You should use “```” for a code block in devforum posts to make the code more readable.

Not to mention you spelt workspace wrong aswell

thats because the value isnt really in the workspace its was an example

the value was already determined also this snip would not work

Change your code to this:

child:SetAttribute("character", 1)

local childstats = workspace.childstats
childstats.Value = 1

if childstats.Value == child:GetAttribute("character") then
	child.Owned.Text = "Equipped"
	child.Owned.TextColor3 = Color3.fromRGB(255, 255, 0)
	child.Owned.Visible = true
end

You should also tell us the errors that appear.

SORRY for wasting you guys’ time because I’ve decided to circumvent and not use attributes and also no that would not work for me. So what I wanted to do is to create a loop that finds a specific object by using attribute values instead of normal values which would allow me to create a sorter that sorts my the players items