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

Help with Density?

Asked by 9 years ago

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

Log in to vote
1
Answered by 9 years ago

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

Ad

Answer this question