how to stop parts from spinning and rotating while theyre floating with bodyposition?
I am working on custom water for my classic roblox type game and it uses body position to float objects which works 100% of the time but they continue to float and rotate and spin i've tried bodygyro but i dont know how to use it. how would I have a part touch the water, then get a body gyro equal to its original orientation? also, theyre all 2048 by 55 by 2048 parts and rely on the player to build something and have it touch the water. its a script in replicatedstorage that is duplicated into every "water part"
01 | local sealevel 1 = script.Parent.Position |
02 | local sealevel 2 = script.Parent.Position.Y |
05 | script.Parent.Touched:Connect( function (part) |
06 | if part.Name = = "HumanoidRootPart" |
07 | then local bodyposition = Instance.new( "BodyPosition" ,part) |
08 | bodyposition.MaxForce = Vector 3. new( 0 , math.huge , 0 ) |
09 | bodyposition.Name = "BP" |
10 | bodyposition.Position = Vector 3. new( 0 ,sealevel 2 + (script.Parent.Size.Y / 2 ), 0 ) |
14 | script.Parent.Touched:Connect( function (part) |
15 | if part.Parent.Name = = "Floatable_Parts" or test = = true |
16 | then local bodyposition = Instance.new( "BodyPosition" ,part) |
17 | bodyposition.Name = "BP" |
18 | bodyposition.MaxForce = Vector 3. new( 0 , math.huge , 0 ) |
19 | bodyposition.Position = Vector 3. new( 0 ,sealevel 2 + (script.Parent.Size.Y / 2 ) + 0.2 , 0 ) |
23 | script.Parent.TouchEnded:Connect( function (part) |
24 | if part:FindFirstChildWhichIsA( "BodyMover" ) then |
25 | part:FindFirstChildWhichIsA( "BodyMover" ):Destroy() |