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

Help with Density?

Hey there guys-

Today I was playing around with the new Density feature ROBLOX added within a part's "CustomPhysicalProperties". I'm trying to assign Density to a value whenever I try I get the following error:

22:15:12.974 - PhysicalProperties.Density cannot be assigned to 22:15:12.975 - Script 'Workspace.Part.Script', Line 2 22:15:12.976 - Stack End

The script the error refers to is as follows:

wait(2)
script.Parent.CustomPhysicalProperties.Density = script.Value.Value

There has got to be a way to change density but I have yet to learn how as of yet so any help would be great!

Thanks, lordrex12345

1 answer

✓ Accepted answer

so basically whenever your attempting to change a physics, you have to change them all them all at once. You cant just change 1 value because its more like a read only for returning a number. so to cahnge it you must do the following

script.Parent.CustomPhysicalProperties = PhysicalProperties.new(density,friction,elasity)--change to number values

You have to choice to change just 3 or all 5. The exact order you must put values it density, friction, elasticity, frictionWeight, elasticityWeight. If changing only 4, use all 5 values

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