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

How to prevent rocket propulsion from moving in the Y axis?

Asked by 6 years ago
Edited 6 years ago
local RP = Instance.new("RocketPropulsion")  -- Rocket Propulsion
RP.Parent = monster.HumanoidRootPart -- Parent
RP.Name = "mover"    -- Name       
RP.MaxSpeed = 7.5      -- How fast it goes
for i = 1,#list do
    if list[i].Name == "Point" and list[i].order.Value == 2 then -- Find Next Location
        RP.Target = list[i] -- Set Target
        local part1 = monster.HumanoidRootPart
        local part2 = list[i]
        part1.BodyGyro.CFrame = part2.CFrame -- make it stay up strait
    end
end
local bforce = Instance.new("BodyForce",monster.HumanoidRootPart) - body force
local maxMass = 0 -- total mass of model
local blist = monster:GetChildren()
for i = 1,#blist do
    maxMass = maxMass + blist[i]:GetMass() -- add masses of each part together
end
bforce.Force = Vector3.new(0,workspace.Gravity * maxMass,0) -- cancel gravity
RP:Fire() -- cause model to move

So i'm using rocket propulsion to make a model move but when slowed to a certain amount it starts to sink so I decided body force was the best option to cancel the effects of gravity(Tested by removing RP:Fire() model isn't affected by gravity)

But the problem is the rocket propulsion is overriding the body force so it still sinks when slowed to a certain amount.

So the question is: Is there a way to either cancel rocket propulsion force in the Y-Axis or to have bodyforce move to certain points on the map?

Answer this question