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?