How to get the object by its properties

for example
lets take e as intvalue (object)
local e=workspace.intvalue
local d=e.value

how to get e from d

You can’t. The value is literally just a number. It contains no information about where the number came from.

The closest you can come is tracking changes yourself or by searching through all of them for matches.

You can use an ObjectValue to store instances, but other than tht no.

Impossible. Value returns the value directly. So no way.

Just use the “e”?

local function getValueInstancesWithValue(value)
	local valueInstances = {}
	for _, service in ipairs(game:GetChildren()) do
		local success, result = pcall(function()
			return service:GetDescendants()
		end)
		
		if success then
			if result then
				for _, valueInstance in ipairs(result) do
					if valueInstance:IsA("ValueBase") then
						local success2, result2 = pcall(function()
							return valueInstance.Value == value
						end)
						
						if success2 then
							if result2 then
								table.insert(valueInstances, valueInstance)
							end
						else
							warn(result2)
						end
					end
				end
			end
		else
			warn(result)
		end
	end
	return valueInstances
end

local valueInstances = getValueInstancesWithValue(0) --Gets all value instances which have a number value of 0.
for _, valueInstance in ipairs(valueInstances) do
	print(valueInstance.Name)
end

As has been suggested, you can iterate over all value instances and check if their values match the value you’re searching for.

1 Like