This is a local script. The top half of the if statement works. The bottom half I need help with. The original material is the material of all the parts in workspace but the materials arent the same.
local Smooth = Enum.Material.SmoothPlastic
local UnSmooth = Enum.Material -- Original Material?
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Text == "Off" then
script.Parent.Text = "On"
for i,v in pairs(workspace:GetDescendants()) do
if v:IsA("Part")then
v.Material = Smooth
end
end
elseif script.Parent.Text == "On" then
script.Parent.Text = "Off"
for i,v in pairs(workspace:GetDescendants()) do
if v:IsA("Part") then
v.Material = UnSmooth
end
end
end
end)

7 comments
btw the script from kingblaze_1000 is good
And I dont even tested mine sooooo
Thanks XD
let me edit it
Your code blocks are broken
*edited
*edited