You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to change BodyGyro’s MaxForce using a button.
-
What is the issue? Include screenshots / videos if possible!
I cant figure out how to change the value.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
n/a
local function onClicked()
script.Parent.Parent.Parent.BoatControl.VehicleSeat.Script2.Disabled = false
script.Parent.Parent.Parent.BoatControl.VehicleSeat.BodyGyro.P = 0
script.Parent.Parent.Parent.BoatControl.VehicleSeat.BodyGyro.D = 0
script.Parent.Parent.Parent.BoatControl.VehicleSeat.BodyGyro.MaxTorque.Vector3.new(0,0,0)
script.Parent.Parent.Parent.BoatControl.VehicleSeat.BodyPosition.P = 0
script.Parent.Parent.Parent.BoatControl.VehicleSeat.BodyPosition.D = 0
script.Parent.Parent.Parent.BoatControl.VehicleSeat.BodyVelocity.P = 0
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 Like
(OpenDoorScript) is to change density of all parts in another model which works. All other values in “Script” work for changing components of BodyGyro, BodyPosition, and BodyVelocity.
BodyGyro is deprecated so that might be your issue. On the BodyGyro api reference it is recommended to use AlignOrientation instead.
1 Like
So instead of vector3 i would do :
script.Parent.Parent.Parent.BoatControl.VehicleSeat.BodyGyro.AlignOrientation.MaxTorque.new
Sorry im new to lua, just trying to figure stuff out
Are you saying to replace BodyGyro with AlignOrientation? This is a boat script that moves the boat based off of BodyPosition,BodyVelocity, and BodyGyro. Not sure how I would convert it.
AlignOrientation.CFrame is the pretty much same as BodyGyro.CFrame
For BodyVelocity i’m pretty sure you can use VectorForce instead
And for BodyPosition you can use AlignPosition
Is there a way to adjust MaxForce of BodyGyro even if it is old though? I mean everything else works. Probably would be easier than converting the whole system to new stuff
Yes since these are deprecated it is recommended to use the new stuff
Another way I can get around this is to just completely remove the BodyGyro,BodyVelocity, and BodyPosition from the VehicleSeat after you press the button, but once you press the other button they would have to be re-inserted into the VehicleSeat with the same values as before if thats possible.
All this is to be able to transport a boat I built on a trailer while the button that changes its density is pressed
I figured it out. Since they only effect the vehicle seat, I used the button to change the parent of them to a seperate model outside the boat so they no longer effect it. Then I used another button to bring them back to the right place
1 Like