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

how do i make this script count for multyple bricks holding the same distance for eachother?

Asked by 7 years ago

this is the script i use:

part = workspace.Orbit
center = part.Center.Position
body = part.Orbitingbrick
axis = Vector3.new(0.25,1,0.5)
radius = (body.Position - center).Magnitude
space = CFrame.new(center,center+axis)
delta = tick()
timer = 0
multiplier = 1

game:GetService("RunService").RenderStepped:connect(function()
    delta = tick() - delta
    timer = timer + delta

    body.Position = space:toWorldSpace(CFrame.new(radius*math.cos(timer*multiplier),radius*math.sin(timer*multiplier),0)).p

    delta = tick()
end)

problem is it only counts for 1 part how can i fix that it counts for multyple and that they hold the same distance from eachother? i also tried this:

Part = workspace.Orbit
brick = Part.Center
orbittingbrick = Part.Orbitingbrick
distancefrombrick = 5 --change however you want

while true do
 for i = 1,360 do
  wait()
   orbittingbrick.CFrame = brick.CFrame * CFrame.Angles(0,math.rad(i),0) * CFrame.new(0,0,-distancefrombrick)
 end
end

sorry if the awnser is really easy i just dont know and started scripting yesterday.

Answer this question