01 | local i = 0 |
02 | local Distance = 5 |
03 | local Speed = 0.07 |
04 | local Angle = 0 |
05 | local Part = script.Parent |
06 | local Orbiting = script.Parent.Parent.HumanoidRootPart |
07 |
08 | while true do |
09 | i = i+ 1 |
10 | wait() |
11 | Part.CFrame = Orbiting.CFrame*CFrame.fromEulerAnglesXYZ(Angle,i*Speed, 0 )*CFrame.new( 0 ,- 2 ,Distance) |
12 | end |
The 'Part' slowly orbits the player but if the player rotates the part follows the player roatation, is there anyway to prevent this?
By using Orbiting.CFrame you're getting the player's rotation, you can instead create a new CFrame with no rotation through the following:
1 | CFrame.new(Orbiting.Position) |
I can't see the whole line, but consider using the position of the character rather than the CFrame as that contains the rotation.
1 | CFrame.fromEulerAnglesXYZ()*CFrame.new() + Orbiting.Position |