Change Materials is not working

In the video it shows mw trying to change to a simpler material back to a more high-def one (for low-end users). If should change the baseplate’s material back to Enum.Material.Grass, but doesn’t, and instead give me an error: Unable to assign property Material. EnumItem, number, or string expected, got nil.

I checked in the properties; the attribute does not show nil. I’m guessing it’s another one but i cannot tell what.

my code for adding the attribute:

wait()
for i,v in pairs(workspace:GetDescendants()) do
	if v:IsA("BasePart") then
		v:SetAttribute("OgMaterial",v.Material.Name)
	end
end

My one for when the button is pressed:

on = true

script.Parent.Activated:Connect(function()
	on = not on
	game.ReplicatedStorage.ChangeToSimpleMetrials:Fire(on)
	script.Parent.Text = (script.Parent.Text == "On" and "Off" or "On")
end)

And my one for handling when it changes (client side):

game.ReplicatedStorage.ChangeToSimpleMetrials.Event:Connect(function(on:boolean)
	if on  == true then
		for i,v in pairs(workspace:GetDescendants()) do
			if v:IsA("BasePart") then
				v.Material = v:GetAttribute("OgMaterial")
			end
		end
	else
		for i,v in pairs(workspace:GetDescendants()) do
			if v:IsA("BasePart") then
				v.Material = Enum.Material.SmoothPlastic
			end
		end
	end
end)

Does anyone know what’s going on?

For the first snippet,

v:SetAttribute("OgMaterial",v.Material.Name)

Try changing it to

v:SetAttribute("OgMaterial",v.Material)

Oh.
it was v.Material instead of v.Material.Name before making this post but it didnt work so i tried that

so i’m not gonna try that, sorry

plus having the name should still work, according to the error