Hello, How would I print all the names of the scripts parents propites like transparency, color, Brickcolor and more just the names ktho not the values of the propites?
I wonder what your use case is with the way of finding all properties of one’s instance’s parent. Indexing the said properties will return the value of the instance. It is unclear what your work is currently like, and would need you to show some code if you have them.
At the moment I have no code as I’m not to sure on how to do it my self and all I want it to do is print the names of all properties.
Wat I truly want is a scrip to print every propertie that a object has tp another object like if 1 objec had transperncy ad another also had it ten ti would print the word transpency
there isn’t any way to get properties from an instance without indexing them, you’d have to do something like this
properties = {"Transparency","Color"}
for _, property in properties do
pcall(function()
print(part[property])
end)
end
manually indexing them is your only option then you can check if the part has the property by pcalling it
There’s no roblox method to get a list of all properties an instance has. You need to rely on some modules or 3rd parties to do that.
You can use the for loop.
local parent = script.Parent
for propertyName, propertyValue in pairs(parent:GetChildren()) do
print(propertyName)
end
Is there a way to check if a part has the same properties then another and if so print the propertie that it has?
Yes there is a way to do this.
Here is a simple example
local part1 = game.Workspace.Part1 – replace with the first part you want to compare
local part2 = game.Workspace.Part2 – replace with the second part you want to compare
for propertyName, _ in pairs(part1) do
if part2[propertyName] ~= nil and part1[propertyName] == part2[propertyName] then
print(propertyName … " matches!")
end
end
For knowledge how would I apply the proerties to a part
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.