Help with Scripting to change Properties in CustomPhysicalProperties

So I’ve been trying to make a weather thing, that if it Snows, the ground becomes Ice Material, which works, But, I get a error when I’m trying to change the Friction and Friction weight in CustomPhysicalProperties in the script!

I’ve tried Searching on YT and looking on the Dev Hub, Saw nothing.

-- Variables.
local x = workspace.GroundParts:GetChildren()
local condition = game.ReplicatedStorage.MainStuff.Weather

-- Conditions.
local Conditions = {
	
	A = "  ☀️ Sunny ☀️",
	B = "  ❄️ Snowing ❄️",
	C = "  🌨️ Hailling 🌨️",
	D = "  🌧️ Raining 🌧️",
	E = "  ⛈️ Stormy ⛈️",
	F = "  🌪️ Tornado 🌪️",
	G = "  🌫️ Foggy 🌫️",
	
}

-- Script.
while wait(10) do
	local NewCondition = math.random(1, 2)
	print(NewCondition)
	if NewCondition == 1 then
		condition.Value = Conditions.A
		for i, part in pairs(x) do
			part.Material = "Plastic"
		end
	end
	
	if NewCondition == 2 then
		condition.Value = Conditions.B
		for i, part in pairs(x) do
			part.Material = "Ice"
			wait(.3)
			part.CustomPhysicalProperties.Friction = 0.1
			--print(part.FrictionWeight .. " : " .. part.CustomPhysicalProperties.FrictionWeight)
		end
	end
	
	if NewCondition == 3 then
		condition.Value = Conditions.C
	end
	
	if NewCondition == 4 then
		condition.Value = Conditions.D
	end
	
	if NewCondition == 5 then
		condition.Value = Conditions.E
	end
	
	if NewCondition == 6 then
		condition.Value = Conditions.F
	end
	
	if NewCondition == 7 then
		condition.Value = Conditions.G
	end
end

ONLY HELP IF YOU’VE GOT TIME!

You can’t assign physical properties separately and the values should be inside a physical properties constructor

part.CustomPhysicalProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight (optional), elasticityWeight (optional))
1 Like

Oh thanks! Didn’t know this! :smiley: