How to make a perpetual motion machine script?

I want to do it like in this video. What kind of script do I need to write?

ezgif-3-0f5ee596fb

Seems like the curvature of the metal part of that device is which applies the direction of the ball, and its using somekind of electromagnete to apply a force to the ball so it has enough to jump back into the “wood bowl”.

Blue arrow would be where the magnet could be
image

If you dont care about the physics, just create an animation. Use an animationController.
If this is about the roblox physics, should be needed to apply a force to the ball as the magnet does in the real one.

2 Likes

Physics would be impossible since the law of conservation of energy is impossible in this case.

Kinetic Art Perpetual Motion Machine, the one you’re attempting to recreate, uses some hacky tricks to replicate a perpetual motion. When the marble falls into the pit, a force is applied to said msrble, since the mere speed of it falling is not enough for it to climb the track and get back.

Contrary to what @Dev_Peashie said, an electro magnet is not possible. The entire machine is powered by electricity, but the track is metallic, and the end of the track shows no signs of any magnets.

Should the magnet exist the end of the track must not be curved back as the impulse would be too great and the marble will miss the target.

The force is applied using a gear at the start of the track, and ending when the marble starts to climb, which will eventually lose enough speed to fall to where it started and not go too far. The curve at the end is what allows the marble, with the exact speed and deceleration, to return back.

Your best bet is to try an animation. Otherwise, you will have to model the track in order to get a perfect physics-based motion machine, then script the adequate speed.

2 Likes

I think you are right, that thing would be applying the force when ball is at the start of the track by using a gear or something to apply force to the ball.

The perfect track and the exact speed will cause the ball returns starting point.

As I said, its a good project for playing with physics, otherwise, just create an animation it will look cool :3

1 Like

Not too sure, but i’d finish the track turn that side transparent to give the illusion it is “jumping” and apply a velocity script at the visible “end”.

2 Likes

Idk, that would be a ball with infinite power, traveling in a tunnel, causing physics calculations of the engine when ball bouncing with the tunnel’s walls.
Would be wasting physics engine calculations for something that is not even intended to play with roblox physics as a project.

Wasting resources for something that could be done with an animation, if playing with physics is not important for the project.

1 Like

I was giving options as you already suggested an animation. Unless he makes multiple animations to give it randomity, it will be very repetitive.

3 Likes

Good point, you are right. When the ball rotates on the starting point couldnt be an animation.

Maybe only 1 animation. When the ball goes thru the hole, start the animation of the ball running on the metal track, complete the jump, and let it fall to the starting point where it spins done by unAnchor the ball and let it spin freely… idk…

1 Like

Good idea. Give me more details for scripts?

You could probably either use a invisible conveyor or have a script parent force to the ball when touching a non-collide part and remove it halfway through to have it slow down.

Yes, I don’t know how to do a script to speed up the ball. How can I do this? Which documents i need read?

in the hole put an invisible block down. and when the ball touches it multiply the velocity so it will jump back to the start

Yes, I know, I’m asking how to write this script. Which documents i need?

whenever a part is touched it can be called by part.Touched:Connect(function)
so we can apply this by

local part=game.Workspace[PartName]
part.Touched:Connect(function(PartTouched)
	PartTouched.LinearVelocity*=5
end)

Thanks but not anything changed. Script not work.

i forgot, but I think you may also need a LinearVelocity object in your ball; also it should probably be destroyed so it doesn’t multiply exponentially.

How to add LinearVelocity object?

Insert Object > LinearVelocity > Parent to part
otherwise
plus sign next to part > Linear Velocity

What is wrong? Not working.

ServerScriptService:

local part=game.Workspace.ball2

part.Touched:Connect(function(PartTouched)
	PartTouched.LinearVelocity*=5
end)

image
image

Im pretty sure its not supposed to be the ball. It should be an invisible block for the hole in the funnel. So in which the ball touches it. It will multiply the speed.
The problem with this script
part.Touched:Connect(func(PartTouched)...end)

Mainly PartTouched is gonna have its velocity multiplied and not the ball, because PartTouched is whatever touches part, and you set part to the ball. So part is not supposed to be the ball. The invisible block is

ball=game.Workspace[BallName]
invisblock=game.Workspace[InvisibleBlockName]
invisblock.Touched:Connect(function(PartTouched)
    if PartTouched==ball then
        PartTouched*=5
    end
end)

also LinearVelocity is an attribute of an part so you dont have to add a BodyMover or whatever.