I was told about classic functions for a tool that changes your Material and Colors, It also uses :GetChildren()
Can anyone tell me how to use class functions?
I was told about classic functions for a tool that changes your Material and Colors, It also uses :GetChildren()
Can anyone tell me how to use class functions?
It’s really simple. Luau’s syntax is really helpful.
Let’s talk about how GetChildren works. It returns a table of the children, but it’s gonna
be really hard to change any part in there, if roblox didn’t have in pairs(), it’s useless.
So a simple loop can do it.
Let’s name the target instance part: Instance. First let’s check if it’s a BasePart.
if part:IsA(“BasePart”) then
Then we can change it now, such as what you’ve seen in tools. —— FULL SCRIPT ——
for _, part: Instance in pairs(partParent:GetChildren()) do
if part:IsA(“BasePart”) then
-- your code
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
What do you mean? Sorry if I didn’t understand your question. Like what are you trying to achieve? Like changing the colors of all children?