Instance:GetAttributeChangedSignal and Instance.AttributeChanged both don't work

Currently both Instance:GetAttributeChangedSignal and Instance.AttributeChanged don’t work when I test them, I was testing them by using the code below:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

ReplicatedStorage:SetAttribute("test",false)

local test = ReplicatedStorage:GetAttribute("test")

ReplicatedStorage:GetAttributeChangedSignal("test"):Connect(function() -- doesn't work
	print("hmm")
end)

ReplicatedStorage.AttributeChanged:Connect(function(attributeName) -- doesn't work
	print(attributeName)
	
	if attributeName == "test" then
		print("hmm")
	end
end)

print(test) -- prints 'false'

test = true

print(test) -- prints 'true'

Does anyone know if they are disabled at the moment or if there’s something wrong with the code?

1 Like

I may be wrong but, I am pretty sure that you can’t set attributes to Roblox services, only instances.

Since this is part of ReplicatedStorage, you are probably listening for client changes server-side, so that’s why it doesn’t work. And @PrismaticFruits is right, you can’t set attributes to services. Server-side ReplicatedStorage is individual replica, as well as client-side storage. Are you sure you are really changing attributes?

1 Like

They don’t work for instances too, test them for yourself and you will see that they don’t work.

Are you currently using LocalScripts?

No, I’m using a script.

I think that it doesn’t matter if I’m using a script or a local script anyways.

Maybe try removing this bit as there is something similar underneath it.

ReplicatedStorage:GetAttributeChangedSignal(“test”):Connect(function() – doesn’t work
print(“hmm”)
end)

That won’t have any effect on the code.

im thinking that this will just return the value and when you change it, the attribute wont change, but the value of the variable will. This is just my guess

you are changing variable test, this does no effect to attribute.

change to ReplicatedStorage:SetAttribute("test", true) will work.

1 Like

That doesn’t make any sense because both of them don’t work anyway and they are supposed to work whenever ‘test’ changes.

I tried that and it doesn’t fix the issue.

Wrong. just changing variable does not take any effect to attributes.

1 Like

Have you tested if they work for yourself?

If so then can you tell us what the code that you used looked like?

script:

local instance = Instance.new("Part")
instance:SetAttribute("Something",false)
instance:GetAttributeChangedSignal("Something"):Connect(function()
	print("Changed.")
end)
instance:SetAttribute("Something",true)

log:

18:38:09.232  Changed.  -  Server - Script:4
1 Like

Also this code did not work:

local instance = Instance.new("Part")
instance:SetAttribute("Something", false)
local Something = instance:GetAttribute("Something")
instance:GetAttributeChangedSignal("Something"):Connect(function()
	print("Changed.")
end)
Something = true

log:

(Nothing)

Use :SetAttribute to change it. You’re just changing the “test” variable which is a boolean.

3 Likes

yes what i said, your just changing the variable but not the attribute value itself