Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

(I need help. Waited 3 days so far and asked 2 times Please Help)Cframe rotation malfunction. ?

Ok, This code is designed to rotate a model(ArmRotatorTwo) but it only rotates 1 time and stops, but it moves up and to the right like I want.

I need help, this has to rotate slowly to -65 and move up and right to maintain its position.

I have been looking for video's and internet help for 4 days. can anyone help me please.

everything works but the rotation.

local ArmOne = script.Parent.Parent.ArmRotatorTwo.ArmOne
local ArmTwo = script.Parent.Parent.ArmRotatorTwo.ArmTwo
local Rotater = script.Parent.Parent.BraceRotater
local Four = script.Parent.Parent.ArmRotatorTwo.PartFour
local One = script.Parent.Parent.ArmRotatorTwo.PartOne
local Three = script.Parent.Parent.ArmRotatorTwo.PartThree
local Two = script.Parent.Parent.ArmRotatorTwo.PartTwo
local Brace = script.Parent.Parent.ArmRotatorTwo.Brace
local Left = script.Parent.Parent.ArmRotatorTwo.LeftArm
local Right = script.Parent.Parent.ArmRotatorTwo.RightArm
local Model = ArmTwo.Parent
local Prime = Model.PrimaryPart
local ArmRotation = ArmTwo.Rotation.Z
local NumberOne = 0
local NumberTwo = 0


	Rotater.CanCollide = false
	ArmOne.CanCollide = false
	ArmTwo.CanCollide = false
	Four.CanCollide = false
	One.CanCollide = false
	Three.CanCollide = false
	Two.CanCollide = false
	Brace.CanCollide = false
	Left.CanCollide = false
	Right.CanCollide = false
	

function Rotate()
	wait(.5)
	
	print ("Start")
	
	while (ArmRotation > -65) do	
	
		Model:SetPrimaryPartCFrame(CFrame.new(Prime.CFrame.X - .05, Prime.CFrame.Y + .05, Prime.CFrame.Z))
		wait(.2)
print ("Done Step One")
		CFrame.Angles(Prime.Rotation.X, Prime.Rotation.Y, Prime.Rotation.Z - 0.05)
				
print ("Done Step Two")		
		NumberOne = NumberOne + 1
		
		print(NumberOne)
		
		wait(.2)
	   end			
	end
	
 	script.Parent.ClickDetector.MouseClick:connect(Rotate)  
 		
	wait(.1)

	Rotater.CanCollide = true
	ArmOne.CanCollide = true
	ArmTwo.CanCollide = true
	Four.CanCollide = true
	One.CanCollide = true
	Three.CanCollide = true
	Two.CanCollide = true
	Brace.CanCollide = true
	Left.CanCollide = true
	Right.CanCollide = true



3 comments

0

Try replacing CFrame.Angles(Prime.Rotation.X, Prime.Rotation.Y, Prime.Rotation.Z - 0.05) with CFrame.Angles(math.rad(Prime.Rotation.X), math.rad(Prime.Rotation.Y), math.rad(Prime.Rotation.Z - 0.05))

0

Thanks alot for trying to help, but it still must rotates one time to the 0 position and continues to move up and over, i have tried many different things, as well as removing the second command and it still does the same thing. So the second command doesnt do anything for some reason. all of its commands are comming from the first line. I have moved that around many different ways as well and a

0

*just rotates

1 answer

I see that your script runs the function, then it turns the cancollide to true, but then it wouldn't turn false again, as that was only in the start of the script. I guess the solution would be to make the CanCollide true inside the function, then make them false again.

1 comment

0

thanks for the answer, but i moved it and the model still only moves one time and the rest of the code still works, ( the model jumps to Rotatino.Z .0) and stops all in one movement.the rest slowly moves up and over and still prints and counts.

This discussion is preserved as it was. New answers, comments, and votes are closed.