Gears and levers, mechanical logic

Hello dear people,
im trying to make game based on real life mechainics of gears, but i have some problems…

I have no idea how to make gears spin each other with no bugs.


On left side is power gear, its spining on its own, i tried to make other 2 spin but i get them to oscilate or spin in same direction.

Old script:

script.Parent.GearBody.Touched:Connect(function(obj)
if obj.Name=="GearBody" then
speed=obj.Parent.Speed.Value
if speed >0 then
	script.Parent.Speed.Value=speed-speed-speed
	script.Parent.Holder.Attachment.HingeConstraint.AngularVelocity=speed-speed-speed
elseif speed<0 then
		script.Parent.Speed.Value=speed-speed-speed
	script.Parent.Holder.Attachment.HingeConstraint.AngularVelocity=speed-speed-speed
end	end
end)

this script is 2 years old it may not work anymore…

Now i dont want you to make whole suistem for me, just give me idea (or if you want bit of code) how should gear logic work.

Cheers form Serbia.

1 Like

One gear should have let’s say speed 1, Then the gear next to that one should have -1, And the one next to that should have 1 again, This would make them rotate like gears should.

True but, i have to find bether way to connect them.
Should i use RayCasting or other logic?

Why exactly would you use RayCast to “Connect” them, How does it work?

You could just make the gear check for the XYZ next to it, And detect if a gear is there?

please give me some time to draw it.

red arrows are rotation direction, green dots are joint spots, and gray arrow is power direction (form power gear). If i use toc heck for the XYZ , i can make 2 gears bug and spin each other with no source of energy (motor).

My idea is to use RayCasting to make gears like wire.


see? they are spining in same direction and each other with no source or energy

i removed power gear when gears started

I’m sorry if this will be weird to read, I’m not sure how to word it.

You could do it like this:

  1. When someone places a source gear, Create a model with the source gear in it.
  2. When someone connects another non-source gear to the existing source gear, Add it to the model.
  3. Have a script detect what gears are connected to a source gear, And make them rotate.

Would this work, The script could detect the source gear is removed and make the gears stop spinning

Good idea! I will use it, thank you!

No problem, Let me know if it works!

1 Like

please wait 1-2 hours

(30 c h a r s blyt)


i changed plan a bit… but it works!

I’m glad it worked, Can’t wait to see what your game becomes. :slight_smile:

ouf… nearest stuff is minecraft create mod

Ooh, That mod is neat tho, So i hope it goes well.

this was hardest part, anything else is simple.
i tried 2 years before to make this but failed, now when im big brain i can do it easly


hah, its WORKING


yep it works like real stuff

Wow looks good, Will there be a test place where i could see how this system works ingame?

Yes of course, but wait please.
and i acidentaly made electric signal system, so double the fun?
Edit: would you like to help? I nead someone to upload some sounds. I only have 2 robux so i cant do it…