Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- in StarterCharacterScripts
- local RunService = game:GetService("RunService")
- local character = script.Parent
- local HRP = workspace.Pivot
- local orbitPart = workspace.Oribiter
- local pivot = workspace.Pivot
- orbitPart.Anchored = true
- local CYCLE_DURATION = 3
- local DISTANCE = 10
- local i = 0
- RunService.Heartbeat:Connect(function(dt)
- i = (i + dt/CYCLE_DURATION) % 1
- local alpha = 2 * math.pi * i
- print(alpha)
- orbitPart.CFrame = CFrame.Angles(0, alpha, 0)
- * CFrame.new(0, 0, DISTANCE)
- + HRP.Position
- end)
- -- link
- -- https://devforum.roblox.com/t/part-to-orbit-around-player/1031587
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement