SetAttribute() doesn't work

Why when i try to set attribute, it does not show up in property window, and does not fire the attribute changed event? If i print :GetAttribute(), it still prints it normally. I tried looking up solutions and look for help on discord, but no one has a solution to this. I used to set attribute in the same way, but the script was inefficient in general so i had to change it.

local storage = script.Parent
local parts = storage.Parts
local config = storage.Configuration

local parts = game.ReplicatedStorage.Clones:WaitForChild("Parts")

local rate = config:GetAttribute("Rate")

config.AttributeChanged:Connect(function(att)
	if att == "Rate" then
		rate = config:GetAttribute("Rate")
	end
end)

while true do
	local chosenPartsFolder
	for i,v in parts:GetChildren() do
		local num = v:GetAttribute("Rarity")
		local num0 = math.random(1,num)
		if num0 == num then
			chosenPartsFolder = v
		else
			chosenPartsFolder = parts.Common
		end
	end
	local chosenPart
	for i,v in chosenPartsFolder:GetChildren() do
		local num = v:GetAttribute("Rarity")
		local num0 = math.random(1,num)
		if num0 == num then
			chosenPart = v
		else
			local partName = chosenPartsFolder:GetAttribute("Default")
			chosenPart = chosenPartsFolder:FindFirstChild(partName)
		end
	end
	
	parts:SetAttribute("White",1)
	
	local Value = chosenPart:GetAttribute("Value")
	local currentValue = config:GetAttribute("Value")
	local parts = config:GetAttribute("Parts")
	config:SetAttribute("Value",currentValue + Value)
	config:SetAttribute("Parts",parts + 1)
	
	task.wait(rate)
end```
1 Like

Are there any errors and are you sure all the attributes are set correctly?

1 Like

no there are no errors and yes i set all the attributes correctly

1 Like

Try to output the value of the rate and the value of the attribute before task.wait(), if they are equal, then everything is working correctly and you made a logical mistake somewhere.

1 Like

it prints but i really have no idea whats the issue. i’ve made sure a couple times its referenced correctly. the script is in a model, which is stored in variable local storage = script.Parent, then i get the parts children of it which is located in storage, so local parts = storage.Parts, i made sure a couple times, even now that parts are a direct children of storage and script.Parent is storage

1 Like

Can you send the model/place (you can in the DM)

1 Like

image

show the code where you change the rate attribute and default rate value

1 Like

I never change its value its for the future

What doesn’t work? I can not understand

1 Like

Set attribute. Despite running :SetAttribute(), it does nots how up in property window, leading attribute changed event not to fire , and mess up my game mechanism

Are you using SetAttribute via server script? and again I don’t understand what’s wrong, your rate does not change or what?

yes
and bro its so simple what im saying theres something called “properties” which you enable in view and if you click on a part in “explorer” which is also enabled in view then something in properties appears, and if you scroll down there are “attributes”, and attributes are supposed to appear here if you run :setAttribute on a part or any instance

1 Like

I’m confused. So the issue is the attributeChanged event doesn’t fire when config:setAttribute is called?
Edit: didn’t see previous post.

no when parts:SetAttribute is called the attribute changed event doesnt fire because i literally said the attributes dont appear in the properties window do you know what properties window is

1 Like

Are you sure you are looking there? This is simply impossible (or you just have a bug studio), the main thing is that the code itself works.

yes im sure i am looking at the model where the script is right now

1 Like

Are you in server view or client view?

it doesnt work in both of them

1 Like

And you don’t see the value/change of the Configuration attribute, but script work?