Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CONFIG
- local Images = {
- On = "rbxassetid://3371570956";
- Off = "rbxassetid://3371570853";
- }
- --
- local Button = script.Parent
- local Saved = {}
- local On = true
- function MaterialsOff(Parent)
- for _, Object in ipairs(Parent:GetChildren()) do
- if Object:IsA("BasePart") and Object.Material ~= Enum.Material.ForceField then
- Saved[Object] = Object.Material
- Object.Material = Enum.Material.SmoothPlastic
- elseif Object:IsA("Model") then
- MaterialsOff(Object)
- end
- end
- end
- Button.MouseButton1Click:Connect(function()
- On = not On
- if On then
- for Object, Material in pairs(Saved) do
- Object.Material = Material
- end
- Button.Image = Images.On
- else
- MaterialsOff(workspace)
- Button.Image = Images.Off
- end
- end)
- Button.Image = Images.On
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement