Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Friction cannot be assigned to?

Asked by 2 years ago

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

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
2 years ago

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
)
0
THANK YOU!! PeterParker17386 16 — 2y
Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
2 years ago

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

Answer this question