Cbrrah
(Cbrah)
September 19, 2021, 8:31pm
#1
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
MrNicNac
(nox7)
September 19, 2021, 8:39pm
#2
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()
Cbrrah
(Cbrah)
September 19, 2021, 10:26pm
#4
MrNicNac:
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?
MrNicNac
(nox7)
September 20, 2021, 12:43am
#5
In that case you need to use a physics-affecting method. Instead of code, just use a BodyAngularVelocity object in the baseplate.