How do i change the spin axis?

I want to change the rotation axis of the Cursors and i dont know how i can do this

right now there spinning like this:

and i want it to spin like this:
Unbenannt

This is my Rotate function the original scipt was made by: br_cks
Profile - br_cks - Developer Forum | Roblox

local center = script.Parent.Parent:WaitForChild("Cookieholder").CenterPart
local function updateOrbit(ply)
	local tbl = dsm.getUpgrades(ply)
	local cursor = game.ReplicatedStorage.Upgrades.Cursor
	local numCursor = tbl.Cursor.Count
	local angleOffset = math.pi * 2 / numCursor
	local timee = tick() * 1
	local angle = timee % (math.pi * 2)

	for i = 1, numCursor do
		local pos = center.Position + Vector3.new(math.cos(angle + angleOffset * (i - 1)), 0, math.sin(angle + angleOffset * (i - 1))) * 4
		local rotation = CFrame.new(pos, center.Position)
		cursor = script.Parent.Parent.Upgrades.Cursor:WaitForChild("Cursor"..i)
		cursor.Position = pos
		cursor.CFrame = rotation * CFrame.Angles(0, math.pi / 2, 0)
	end
end

You will need to alter the positions the parts are first placed at, as well as the orbit function

Where the positions are first set is changed from

parts[i].Position = center.Position + Vector3.new(math.cos(angleOffset * (i - 1)), 0, math.sin(angleOffset * (i - 1))) * radius

To this →

parts[i].Position = center.Position + Vector3.new(math.cos(angleOffset * (i - 1)), math.sin(angleOffset * (i - 1)), 0) * radius

Then within the orbit function, this:

local pos = center.Position + Vector3.new(math.cos(angle + angleOffset * (i - 1)), 0, math.sin(angle + angleOffset * (i - 1))) * radius

changes to this →

local pos = center.Position + Vector3.new(math.cos(angle + angleOffset * (i - 1)), math.sin(angle + angleOffset * (i - 1)), 0) * radius
1 Like

Better yet, here’s a version you can simply rotate the direction you want

Enjoy, hope this helps :slight_smile:

1 Like