I have been Stupid again (Loop/Rotation/PrimaryPart)

Good Morning from Berlin,

i have been Stupid again. I want to Move the Model (seen in the Picture) to a Certain point with Tweenservice. I know how to do that and it works. Now i want the Model to Rotate a Certain amount so it shows us its Backside.

The Script im Using is a Loop so the Model does not Jump back to its Position when Rotated by the Script. But the Model does Rotate Violently until it Stops after a few Seconds.

How can i go by to actually Control the Speed and the Degrees of how the Model turns. I tried a lot and cant figure it out especially using Tweenservice at the same time. I hope someone can help me as this is getting frustrating

Here is the Script:

local Model = game.Workspace.HarvTest

script.Parent.Parent.ClickDetector.MouseClick:Connect(function()
	
	for i = 1, 360 do
		Model:SetPrimaryPartCFrame(Model.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(i), 0))
		wait(0.1)
	end
end)

I hope this is not a Silly Question but getting help is sometimes quite hard without being laughed at.
Thanks for any Input how to make my Life easier and hope you have a great Weekend

Try this:

local Model = game.Workspace.HarvTest

local speed = 3
script.Parent.Parent.ClickDetector.MouseClick:Connect(function()
	
	for i = 1, 360/speed do
		Model:SetPrimaryPartCFrame(Model.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(i*speed), 0))
		wait(0.1)
	end
end)

robloxapp-20220423-0950215.wmv (1.4 MB)

Sadly didnt work. It does now Spins back and forward BUT shows me his back in the end.

Oops. Made a mistake XD
Here:

local Model = game.Workspace.HarvTest

local speed = 3
script.Parent.Parent.ClickDetector.MouseClick:Connect(function()
	
	for i = 1, 360/speed do
		Model:SetPrimaryPartCFrame(Model.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(speed), 0))
		wait(0.1)
	end
end)
1 Like

Awesome that worked like a Charm.

So if i want to change the Speed i just change the Variable in Speed and the Angle behind the 1 in “for i”.
That is such a LIFESAFER thank you!

1 Like

You just need to change the speed. If you want it to go faster, then increase the speed variable. If you want it to go slower, decrease it.

1 Like

Awesome. Thank you so much again!

1 Like