How to make part orbit around player smoothly using serverscript

I want to make part that orbit around player smoothly and everyone see it using server script

5 Likes

im sure u could make that by using RunService:Heartbeat()

Thanks but I want it to be smoothly

Try using the Search tool up top and type in ‘rotating pets’ or ‘make pets spin around player’. I’ve seen a few solved posts in the past that use that terminology.

Have you considered using LocalScripts? Using them is the best way to make a smooth movement.
Use a central server script to control the system, but let each client animate the orbit themselves.

In case anybody is trying to figure out how to do this in the future, or if you directly need it, I coded this simple script that creates a part and makes it orbit around your character within a certain radius:

wait(3)

local plr = game.Players.LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()

local part = Instance.new("Part")
part.CanCollide = false
part.CanTouch = false
part.CanQuery = false
part.Name = "orbiting"
part.Parent = workspace
part.Size = Vector3.new(2,2,2)
part.Position = -Character.HumanoidRootPart.CFrame.RightVector * 10 --Make this number the same as your radius
part.Anchored = true
part.Transparency = 0
part.Color = Color3.fromRGB(0,0,0)

local originPart = Character:WaitForChild("HumanoidRootPart")
local orbitingPart = part

local radius = 10
local angle = 0

while true do
	local newCFrame = originPart.CFrame + (-Character.HumanoidRootPart.CFrame.RightVector * 10) * math.cos(angle) + (Character.HumanoidRootPart.CFrame.LookVector * radius) * math.sin(angle)
	orbitingPart.CFrame = newCFrame
	angle = angle + math.rad(4)
	task.wait()
end

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.