Here you go
To make this we use UserInputService to check if they pressed a button, we also make a variable called toggeled so we know if it's on or off, then when we pressed E or whatever button you want we look through all of the descendants/stuff inside workspace, if the toggled is false and the we find a part, we change the customphysicalproperties else if the toggeled is already true then we revert back to normal
local UIS = game:GetService("UserInputService")
local keyCode = "E"
local toggeled = false
UIS.InputBegan:Connect(function(key, gameProcessed)
if not gameProcessed then
if key.KeyCode == Enum.KeyCode[keyCode] then
for i, v in pairs(workspace:GetDescendants()) do
if not toggeled then
if v:IsA("BasePart") then
v.CustomPhysicalProperties = PhysicalProperties.new(0.05, 0, 0.5, 50, 1)
end
toggeled = true
else
if v:IsA("BasePart") then
v.CustomPhysicalProperties = PhysicalProperties.new(0.05, 0, 0.5, 50, 1)
end
toggeled = false
end
end
end
end
end)