How can I change the material of a part

  1. What do you want to achieve? Keep it simple and clear!
    I want to make this broken lighting effect by changing the material but they don’t change
  2. What is the issue?
    The material don’t change at all.
  3. What solutions have you tried so far?
    I checked the part but the material says neon only, I added print statements but they ran without any problems. I also checked the dev page so I changed the material change with part = Enum.Material.(Material here)

The part I was trying to change the material of is a 3D Text sign

local part = script.Parent

while true do
	part = Enum.Material.Neon
	print("Changed Material for part i")
	wait(3)
	part = Enum.Material.SmoothPlastic
	print("Changed Material for part i")
	wait(5)
end
13 Likes

You have to do
part.Material then what you were doing before was correct (the enum part)

basically:

part.Material = Enum.Material.Neon
7 Likes

I’m pretty sure you could also say

Part.Material = “Neon”

Then you could just list the material as a string.

Either way is completely fine and works the same way. At this point it is your preference.

1 Like

The roblox tab thingy for auto fill does say it does have to do that and the dev roblox page (https://developer.roblox.com/en-us/api-reference/property/BasePart/Material) says it does need to be that

1 Like

It still works the same way regardless. You should try it out. But if the Enum is better for you then you do that.

1 Like

This actually works helps thanks for the info! I misread that then lol

3 Likes

and if the part is inside a model how can i do it?