how to make a part rotate roblox

To make a part rotate in Roblox using Lua, follow these steps:

  1. First, you need to access the desired part. You can do this by using the workspace object followed by the Part function. For example, if the part is named "MyPart", you can access it using workspace:FindFirstChild("MyPart").

  2. Once you have the part, you can apply a rotation to it. Use the CFrame property of the part to set the rotation. The CFrame property represents the position and rotation of the part. To rotate the part, you can use the CFrame.new() function and provide the desired rotation values. For example, to rotate the part by 90 degrees around the Y-axis, you can use part.CFrame = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(90), 0).

  3. After setting the new rotation, the part should start rotating. If you want the rotation to be continuous, you can update the rotation in a loop. You can use a while loop or a RunService event to continuously update the rotation. For example:

while true do
    part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(1), 0) -- Rotates the part by 1 degree around the Y-axis
    wait() -- Waits for a short period of time before the next update
end

Note that the code above will create an infinite loop, so make sure to stop it when needed.

By following these steps, you can make a part rotate in Roblox using Lua.