Hi I'm not good at scripting and I want to know how to change a part's material to a random material when u click a text button I saw something like it before but it only did it once and didn't work again please help
Scripting helpers is not a requesting site so in the future make a script and if you cant find out the error, post it here. But i will help you out anyway. You could make the gui call a remote event. When it is called, you can then use a math.random and use a ling if statement like this (There is probably a better way to do this but this is what i thought of)
local number = math.random(1,3) if number == 1 then part.texture = "concrete" elseif number == 2 then part.texture = "neon" elseif number == 3 then part.texture = "brick" end
This would obviously be longer to fit however many textures you would like to add. To increse the length you would just change the 3 to how many textures you want ~~~~~~~~~~~~~~~~~ math.random(1,3) <--- this 3
and adding another one of these onto the end but changing the number to go up in 1 each time and the texture to a different texture
elseif number == 3 then part.texture = "brick" end ~~~~~~~~~~~~~~~~~ I hope this helps!
Check this
Button.ClickDetector.MouseClick:Connect(function() local Materials = Enum.Material:GetEnumItems() local RandomMaterial = Materials[math.random(#Materials)] script.Parent.Material = RandomMaterial end)