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
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:
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
hi!
what do you mean with (LastPosition,NewPosition)?
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
this is the script i used
i know its not the best
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)
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.
it keeps disappearing
idk why i think i did a mistake with Attachment0
Is it possible for you to send me the place file?
yeah sure
experimenting.rbxl (61.3 KB)
experimenting.rbxl (77.4 KB)
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
Fixed:
experimenting.rbxl (61.9 KB)
(The rocket automatically fires so please remove line 38 and 40.)
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.