How would I make my GUI toggleable? I made a script that when you click a GUI the materials all turn to Smooth Plastic. I want it once it is enabled, you can click it again and all the materials go back to normal. How would I do this?
Script:
local toggled = true
script.Parent.SideMenu.ToggleMats.MouseButton1Click:Connect(function()
for i,v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("UnionOperation") or v:IsA("MeshPart") or v:IsA("TrussPart") or v:IsA("Part") or v:IsA("BasePart") or v:IsA("CornerWedgePart") then
v.Material = Enum.Material.SmoothPlastic
end
end
end)
I really really need help!