Heres the script, it's responding to print the part's name but couldn't find the part's material.
for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "P1" and v:IsA("WedgePart") then
print(v.Name)
if v.Material == "Grass" then -- Not working here
v.BrickColor = BrickColor.new("Medium green")
end
end
end

2 comments
To explain, Enums internally are Integers, not Strings. Enum.Material.Grass == 1280, and 1280 ~= "Grass"
By the way, if this helped you please click the Accept Answer button under my name.