I’m trying to create a palette system in my game so I can have bodies of terrain water that are different colors as my player moves through zones.
I want to cache the default Terrain settings and then apply a diff to them like so:
game.ReplicatedStorage.Sig.ChangePlayerTerrainSettings.OnClientEvent:Connect(function(settings) -- First apply defaults game.Workspace.Terrain.WaterColor = Color3.fromRGB(23,166,182) game.Workspace.Terrain.WaterReflectance = .5 game.Workspace.Terrain.WaterTransparency = .9 game.Workspace.Terrain.WaterWaveSize = .15 game.Workspace.Terrain.WaterWaveSpeed = 10 -- todo material colors? -- Then modify if (settings["WaterColor"] ~= nil) then game.Workspace.Terrain.WaterColor = settings["WaterColor"] end if (settings["WaterReflectance"] ~= nil) then game.Workspace.Terrain.WaterReflectance = settings["WaterReflectance"] end if (settings["WaterTransparency"] ~= nil) then game.Workspace.Terrain.WaterTransparency = settings["WaterTransparency"] end if (settings["WaterWaveSize"] ~= nil) then game.Workspace.Terrain.WaterWaveSize = settings["WaterWaveSize"] end if (settings["WaterWaveSpeed"] ~= nil) then game.Workspace.Terrain.WaterWaveSpeed = settings["WaterWaveSpeed"] end end)
But I would love to not have to spell out every single property I want to override. I was surprised that there was no way to simply iterate over all the properties an Instance has.
I searched around here and found other devs doing some crazy stuff to hack around this limitation.
There should be an API like the one that was recently added for Attributes.