Replacing materials in-game

Greetings. I am trying to replace (or “swap” if you will) a water material when the map loads with another one. I was successful in replacing skybox textures but had no luck with the water material. I searched for info on this matter but did not find anything useful. Thank you in advance.

Give me the snippet of code you used for the skybox, and the name of the map, and I’ll be glad to look into it.

local D = Material(“skybox/sky_clear/”…skyboxname…SourceSkyPre*):GetMaterialTexture("$basetexture")
SourceSkyMat*:SetMaterialTexture("$basetexture",D)

The material I need to replace is nature/water_wasteland002a