Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- local character = script.Parent
- local HRP = character:WaitForChild("HumanoidRootPart")
- local springScript1 = require(game.ReplicatedStorage.SpringModule1)
- local springScript2 = require(game.ReplicatedStorage.SpringModule2)
- local part1 = game.Workspace.Part1
- local part2 = game.Workspace.Part2
- local spring1 = springScript1.new(Vector3.new(), Vector3.new(), Vector3.new(), 15, 2)
- local spring2 = springScript2.new(Vector3.new(), Vector3.new(), Vector3.new(), 15, 2)
- local orbitTime = 30
- local radius = 5
- local eclipse = 1
- local rotation = CFrame.Angles(0, 0, 0)
- local sin, cos = math.sin, math.cos
- local rotationSpeed = math.pi * 2/orbitTime
- eclipse = eclipse * radius
- local rot1 = 0
- local rot2 = 180
- local function renderPart1(deltaTime)
- spring1.target = HRP.Position - Vector3.new(-3, 0, 0)
- part1.Position = spring1.p
- spring1:Update(deltaTime)
- rot1 = rot1 + deltaTime * rotationSpeed
- part1.CFrame = rotation * CFrame.new(sin(rot1) * eclipse, 0, cos(rot1) * radius) + HRP.Position
- end
- RunService.RenderStepped:Connect(renderPart1)
- local function renderPart2(deltaTime)
- spring2.target = HRP.Position - Vector3.new(3, 0, 0)
- part2.Position = spring2.p
- spring2:Update(deltaTime)
- rot2 = rot2 + deltaTime * rotationSpeed
- part2.CFrame = rotation * CFrame.new(sin(rot2) * eclipse, 0, cos(rot2) * radius) + HRP.Position
- end
- RunService.RenderStepped:Connect(renderPart2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement