Help with my Part Rotation Script, it increases speed depending on how high I am

What I’m currently making is a part that rotates on the player’s HRP, though it works properly there’s an issue with its rotation speed.

The issue is that it rotates faster than normal when the player is on a higher, or lower Y-axis, I’ve tried using Angles and CFrame.Orientation but it has the same result,

Since I’m still an intermediate scripter, I didn’t do much complex math so its really basic, How this works is that the rotating blue energy VFX is CFramed - 25 studs away from a rotating invisible part that spawns on your HRP.CFrame and the VFX gradually increases the distance between you and the player sucking anyone in.

Here is the code

local part = Instance.new("Part", Character)
					part.Name = "Spinny"
					part.Anchored = true
					part.Size = Vector3.new(1, 1, 1)
					part.CanCollide = false
					part.Transparency = 1
					part.CFrame = hrp.CFrame 

					local Distance = -25

					for i = 1, 360 do

						part.CFrame = part.CFrame * CFrame.Angles(0,-math.rad(part.CFrame.Y + .1),0)

						BlueHRP.CFrame = part.CFrame * CFrame.new(0,4,Distance)

						Distance -= .25

						task.wait(.01)
					end

When I use this on the ground it works perfectly,

When I’m at a higher altitude, it goes crazy

If anyone could help me figure out what I did wrong it would be much appreciated, thank you.

1 Like

you probably want
CFrame.Angles(0,-math.rad(speedInDegrees),0)

2 Likes

Ah yeah thanks it works, really appreciate the feedback have a good day!

part.CFrame = part.CFrame * CFrame.Angles(0,-math.rad(3),0)

3 Likes

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