Help with rotating a object

So I was making a obby and I needed to rotate these two parts, first im working on one part. (both parts show in the picture) Both of the two parts are ungrouped because I thought that had something to do with it. I have a feeling something to do with my script and I dont know where its to be placed since the part is under a object (pls check image).

If you know what is wrong, would be grateful if you could help out.


2 Likes

is that your full script there?

1 Like

“SpinPart” is an unknown global because it doesn’t exist in the script. You need to reference the part as a variable named SpinPart to fix it.

2 Likes

if you are wanting full rotation constantly you could use a tween setup in loop like this if your model is declared right as SpinPart

local PrimaryPart = SpinPart.PrimaryPart
while wait() do
local tweenblock = game:GetService("TweenService"):Create(PrimaryPart, TweenInfo.new(4,Enum.EasingStyle.Linear,Enum.EasingDirection.Out), {CFrame = PrimaryPart.CFrame * CFrame.Angles(0,math.rad(179),0) })

tweenblock:Play()

tweenblock.Completed:Wait()

end

you can also use a for loop to achieve this by setting the cframe or using a bodymover and setting its cframe rotation

1 Like

I tried a basic script since I’m not too sure with coding. but yea