Spinning Part Issue

What do I want to achieve?


this type of spinning movement

What is the issue?
The spinning part isnt spinning as its supposed to and idk if im supposed to be using hinges or a script to make the part spin

Have you tried other solutions?
Searching on forums, yt and google

This is the script i use to make it spin:

local part = script.Parent -- Don't Delete this or anything!

local speed = 50 -- Change this value to adjust the rotation speed (if you want?)

while true do
	part.CFrame = part.CFrame * CFrame.Angles(0, 0, math.rad(1)) -- Rotate the part by 1 degree around the Z axis
	wait(0.01) -- Wait for one frame before repeating the loop
end

im not a good scripter so it would be nice if you could help

Hi there,
The part in the video seems to consist of three parts: 2 β€˜arm’-like parts and a torso/main part. I assume the arms are connected to the body via a hinge constraint. and the rotation is applied to both arms.
Each arm probably has an angularVelocity constraint connected to an attachment at the pivot point.
This will cause the arms to rotate whilst staying connected to the body, and the contact with the floor should cause the whole structure to move as it does so.

This should (hopefully) make that work without scripts, although the physics stuff can be added with scripts if needed.

Hope this helps!

By the way, make sure to edit the angularVelocity properties and increase the torque until the part rotates as required.

1 Like

Mob.rbxm (6.1 KB)
Love it when you give me something to work with..
That makes the guessing end quickly. Guessing vs Testing.
Thanks @ RuinedSanctuary

Script

--Script in Body
local body = script.Parent
local rightHinge = body:WaitForChild("HingeConstraintR")
local leftHinge = body:WaitForChild("HingeConstraintL")

rightHinge.ActuatorType = Enum.ActuatorType.Motor
rightHinge.AngularVelocity = 1
rightHinge.MotorMaxTorque = 60000

task.wait(2)

leftHinge.ActuatorType = Enum.ActuatorType.Motor
leftHinge.AngularVelocity = 1
leftHinge.MotorMaxTorque = 60000

Everything need to be attached to the right place here.
This was one test; 1 .. 60000 looks pretty close if not spot on.
Play with the numbers for more testing if you need to.
Model is set up right.

If you like this give RuinedSanctuary the solution for putting in the time.

2 Likes

I was able to create something with very similar behavior.

Here is the file. I used HingeConstraints. You should usually use HingeConstraints for spinning things.
Model.rbxm (5.3 KB)


Keep in mind, you will have to adjust this to get it perfect.

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.