local character = workspace:WaitForChild("CleetusSama"):WaitForChild("HumanoidRootPart") -- test code to try out
local DISTANCE = 10 -- radius/distance to rotate from the player.
local increment = 0
local parts = {game.Workspace:GetDescendants("CharPanel")}
local offset = 360/#parts -- make a perfect angle distance for each part no matter how many parts by dividing a whole circle by the amount of parts.
local rs = game:GetService("RunService")
rs.Heartbeat:Connect(function(dt)
increment += dt * 10 -- number is the speed multiplyer
print(increment)
for i,v in pairs(parts) do -- v is the current part
local trueOffset = offset * i
v.Position = Vector3.new(character.Position.X + math.sin(math.rad(increment+trueOffset)) * DISTANCE,character.Position.Y ,character.Position.Z + math.cos(math.rad(increment+trueOffset)) * DISTANCE)
end
end)
I think he meant where it says PartName
Try deleting the brackets around get decadent as that already returns a table.
you mean like this? Sorry i’m probably being dumb
I mean the curly brackets. {} delete those.
now it’s flooding the dev console with this
Show me what you did now because you must be trying to get the decedents of the whole workspace.
try this code:
local character = workspace:WaitForChild("CleetusSama"):WaitForChild("HumanoidRootPart") -- test code to try out
local DISTANCE = 10 -- radius/distance to rotate from the player.
local increment = 0
local parts = game.Workspace.CharPanel:GetDescendants()
local offset = 360/#parts -- make a perfect angle distance for each part no matter how many parts by dividing a whole circle by the amount of parts.
local rs = game:GetService("RunService")
rs.Heartbeat:Connect(function(dt)
increment += dt * 10 -- number is the speed multiplyer
print(increment)
for i,v in pairs(parts) do -- v is the current part
local trueOffset = offset * i
v.Position = Vector3.new(character.Position.X + math.sin(math.rad(increment+trueOffset)) * DISTANCE,character.Position.Y ,character.Position.Z + math.cos(math.rad(increment+trueOffset)) * DISTANCE)
end
end)
its working but only for one of them
Ok, make a folder, put all those things into the folder. Name the folder something. Then replace the
local parts = game.Workspace.CharPanel:GetDescendants()
with
local parts = game.Workspace.FolderNameHere:GetChildren()
thank you oh my god finally its working
Wonderful! If you have any more problems/questions than just ask. If its to fast or slow than you can change the number in the top of the connection.
Fun Fact: I tested the script with 10,000 parts and it worked and only 20 FPS drop
is there a way I could make it start slow, go fast, then go slow again, and then make it stop?
Yes.
On this line:
increment += dt * 10 -- number is the speed multiplyer
replace with:
increment += dt * (math.abs(math.sin(tick() * 0.5)) * 10)
number inside is the rate of speed change and the outside number is the max speed`
is there a way I could make it spin once and end when a specific one is in front of the player?