I made a rocket friend

https://i.gyazo.com/65ced0d0a561ef87b68c45baf8470b09.mp4

It uses a BodyForce and BodyGyro. I played around a lot with some different formulas for how much force to use and settled with this, where the force is proportional to the square of the distance. Its target is a moving point that circles above your head. The force is in the direction of the target plus the velocity of the head minus the velocity of the rocket. The gyro has an upward tilt so it doesn’t look completely gravity defying even though it is.

local head=script.Parent:WaitForChild("Head")
local rocket=Instance.new("Part")
rocket.Size=Vector3.new(1,2,1)
rocket.CanCollide=false
local mesh=Instance.new("SpecialMesh",rocket)
mesh.MeshId="rbxassetid://31601976"
mesh.TextureId="rbxassetid://31601599"
mesh.Scale=Vector3.new(.75,1,.75)
mesh.Offset=Vector3.new(0,-1,0)
local fire=Instance.new("Fire",rocket)
fire.Color=Color3.new(.5,.5,.5)
fire.SecondaryColor=Color3.new()
fire.Size=2
fire.Heat=25
local gyro=Instance.new("BodyGyro",rocket)
gyro.MaxTorque=Vector3.new(math.huge,math.huge,math.huge)
local force=Instance.new("BodyForce",rocket)
local gravity=Vector3.new(0,rocket:GetMass()*196.2,0)
rocket.CFrame=head.CFrame+Vector3.new(0,5,0)
rocket.Parent=head.Parent
while head.Parent do
	local h=head.Position+Vector3.new(0,2,0)+CFrame.Angles(0,math.pi*2*((tick()/2)%1),0).lookVector*20
	local p1=rocket.Position
	local p2=h-rocket.Velocity+head.Velocity
	gyro.CFrame=CFrame.new(p1,p2+Vector3.new(0,10,0))*CFrame.Angles(math.pi/2,0,0)
	force.Force=(p2-p1).unit*((p2-p1).magnitude^2/10+10)+gravity
	wait()
end

(in StarterCharacterScripts)

6 Likes

That’s adorable. good job :smile:

Do you wanna earn a lot of money by selling customizables?

Because this is how you earn a lot of money by selling customizables.

Fixed:

This needs to be a gear??