Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Friction cannot be assigned to?

I want to make a script where the floor becomes slippery but when i run it, it says "friction cannot be assigned to" I am very confused, This is my script.

local RandomNumber = math.random (1,1)

if RandomNumber == 1 then
	game.Workspace.Baseplate.Material = "Ice"
	game.Workspace.Baseplate.CustomPhysicalProperties.Friction = 0
	game.Workspace.Baseplate.CustomPhysicalProperties.FrictionWeight = 100
end

2 answers

✓ Accepted answer

You can't assign or write to the properties directly. Instead, you'd want to construct a new PhysicalProperties object with the properties you desire:

local baseplate = workspace.Baseplate
local originalProps = baseplate.CustomPhysicalProperties

baseplate.CustomPhysicalProperties = PhysicalProperties.new(
    originalProps.Density,
    0, -- Friction,
    originalProps.Elasticity,
    100, -- Friction weight
    originalProps.ElasticityWeight
)

1 comment

0

THANK YOU!!

hey you! have you ever heard of enes? if you are in trouble, better call enes!

This discussion is preserved as it was. New answers, comments, and votes are closed.