How to make a brick spin once on a server script

I’m trying to make my Baseplate spin exactly 360° through a server script. I’ve tried doing research but, I couldn’t find the results I was looking for.

The script I’m using right now:

for i = 1,360,1 do
	game.Workspace.Baseplate.CFrame = game.Workspace.Baseplate.CFrame * CFrame.fromEulerAnglesXYZ(0,1,0)
	wait(1)

It doesn’t spin exactly 360°

1 Like

To rotate, you should use the TweenService. To spin a full 360 degrees, you have to rotate twice by 180 degrees. Shown below.

local baseplate: BasePart = workspace.Baseplate
local tweenService = game:GetService("TweenService")

function spinHalfway()
	local tween: Tween = tweenService:Create(baseplate, TweenInfo.new(2, Enum.EasingStyle.Linear), {
		CFrame = baseplate.CFrame * CFrame.Angles(0,math.pi,0)
	});
	tween:Play()
	tween.Completed:Wait()
end

spinHalfway()
spinHalfway()

Is it possible to make it also move the player when it spins? :slight_smile:

In that case you need to use a physics-affecting method. Instead of code, just use a BodyAngularVelocity object in the baseplate.