Hi i wanted to make a feature where you can lower your graphic and making your game less laggy by removing all the material of the game when you press a textbutton. Is there a way i could do that? here is the script that i used
local button = script.Parent button.MouseButton1Down:Connect(function() for i, v in pairs() do if v:IsA("Part") then v.Material = "SmoothPlastic" end end end)
So the pairs doesn't know what you're trying to do, you need to guide it lol.
local button = script.Parent button.MouseButton1Click:Connect(function() --//Changed this to click so it works for mobile users as well for i, v in pairs(game.Workspace:GetChildren()) do --//We add get children so we gather everything in workspace. if v:IsA("Part") then v.Material = "SmoothPlastic" end end end)