How can I make a material randomize for a part?

Hello everyone! I just want to ask how you can change the materials randomly via script every second. I looked it up but I couldn’t find anything. Please help!

1 Like

Try

local part = path.to.part
local materials = Enum.Material:GetEnumItems()

while wait(1) do
    part.Material = materials[math.random(1, #materials)]
end

Please search before posting, I found this:

6 Likes

Thank you and sorry! Please flag my post!

1 Like