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

Making an object orbit around my torso using BodyPosition?

Asked by 8 years ago

I've tried a bunch of different things and can never get the code right. The best I can get it to do is follow me around.

The following is the section of code I have so far:

me = game:GetService("Players").LocalPlayer
TO = me.Character["Torso"]

local part = Instance.new("Part", me.Character)
    part.Size = Vector3.new(3,3,3)
    part.BrickColor = BrickColor.Random()
    part.TopSurface = "Smooth"
    part.BottomSurface = "Smooth"

local gyro = Instance.new("BodyGyro", part)
    gyro.MaxTorque = Vector3.new(10000,10000,10000)

local bposition = Instance.new("BodyPosition", part)
    bposition.MaxForce = Vector3.new(10000,10000,10000)

while wait() do
    bposition.Position = TO.CFrame.p + CFrame.new(0, 5, 0).p
end
0
do you mean "orbit" as in an attractive force, or do you just mean revolve around an axis at a fixed distance? 1waffle1 2908 — 8y
0
I think he means a sphere rotating around him on the x-axis. By orbit i'm pretty sure he means a small sphere @1waffle1 docrobloxman52 407 — 8y
0
A sphere is not a path. 1waffle1 2908 — 8y
0
I've seen other people do it using BodyForce. I apologize for not clarifying better @1waffle1 . I want the object to revolve around me at a fixed distance. NaughtyMeme 0 — 8y

Answer this question