Why does this not work?


	circle:PivotTo((CFrame.new(PosX,  -2.75, PosZ) + bruh * (modelSize.X*0.5)) )
		
		if RHeld == true and not rebounce then
			rebounce = true
			circle:PivotTo(circle:GetPivot() * CFrame.Angles(0, math.rad(90), 0))
			wait(0.5)

			rebounce = false
		end
		

when rheld, it rotates 90 degrees for a second and turns back, how can i fix this?

1 Like

I have no idea what you’re trying to do, lol. Are you trying to make it rotate for as long as the mouse is held? If that’s the case, you’re better of counting up some variable when the mouse is held, and setting rotation to that.

1 Like

okay, the script is in a heartbeat loop, and RHeld is a variable that keeps track that the key R is being held or not, however, when i hold r, it rotates but instantly goes back

1 Like

this line is resetting it if its in a loop

how would i not reset it?
i tried something like this:

		circle:PivotTo((CFrame.new(PosX,  -2.75, PosZ) + bruh * (modelSize.X*0.5)) * CFrame.Angles(0,math.rad(90),0))

but that would mean it only rotates 90 degree when i press r, but i want to be able to rotate it according to the model’s current rotation

keep a variable for rotation and set that to the pivot to like make R make the variable change by a set amount and make it so RHeld increases that
so like you add the value to the original pivot with the angle and stuff

bruh this worked fine when i used moveto(), it was way easier, couldn’t i do something like getpivot on the first pivot to?

You need to set the initial pivot outside of the loop.

or just do this i guess yea that would be way easier to do lol i just wanted to keep it as similar as possible to yours

wdym? can you elaborate a bit?

The situation right now:

Loop starts

  • you set pivot
  • you check rmb held
  • you set pivot
    Loop ends

The situation you should work towards

originPivot = Set pivot

  • loop starts
  • Check if rmb
  • Set pivot based on originPivot
  • loop ends

nevermind, my method worked lol, no complicated storing and stuff
for yall wondering:

circle:PivotTo((CFrame.new(PosX,  -2.75, PosZ) + bruh * (modelSize.X*0.5)) * circle:GetPivot().Rotation)
		if RHeld == true and not rebounce then
			rebounce = true
			circle:PivotTo(circle:GetPivot() * CFrame.Angles(0, math.rad(90), 0))
			wait(0.5)

			rebounce = false
		end

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