How to make rocket?

hey
im new to roblox studio but i know some basics about lua and i need help on making some thing like this
-what i want:


-what happens

6 Likes

If you are using Roblox physics then you can use AlignOrientation to rotate the object using this formula:

local rotation = CFrame.new(LastPosition,NewPosition)
LastPosition = NewPosition
4 Likes

hi!
what do you mean with (LastPosition,NewPosition)?

2 Likes

NewPosition is the current position of your rocket. So:

local rocket = Your_Rocket
local LastPosition = rocket.Position
while rocket do
     local NewPosition = rocket.Position
     local Rotation = CFrame.new(LastPosition,NewPosition)
     LastPosition = NewPosition
     rocket.AlignOrientation.CFrame = Rotation
     task.wait()
end
2 Likes

this is the script i used
i know its not the best :sweat_smile:

local rocket = script.Parent
local click = rocket.ClickDetector
local thrust = rocket.VectorForce

click.MouseClick:Connect(function()

rocket.WeldConstraint:Destroy()

thrust.Enabled = true
wait(1)
thrust.Enabled = false


end)
2 Likes

Okay, so what you can do is insert an attachment instance in your rocket with an AlignOrientation instance with it. You can then set it’s Mode to OneAttachment and set the Attachment0 property to the attachment you just created and then use the code i provided.

3 Likes

it keeps disappearing
idk why i think i did a mistake with Attachment0
image

1 Like

Is it possible for you to send me the place file?

1 Like

yeah sure
experimenting.rbxl (61.3 KB)

1 Like

experimenting.rbxl (77.4 KB)

2 Likes

thank you so much
the notes are very helpful:3

Yes, now I recommend marking my post as the solution to let others know.

there is a small problem
The rocket flies backward
image

Fixed:
experimenting.rbxl (61.9 KB)

(The rocket automatically fires so please remove line 38 and 40.)

2 Likes

Works, thanks.
I’ll edit the script a bit, there’s a noticeable delay between launch and the gyro working.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.