Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a toggled conveyor? [closed]

Asked by
AdamTHM -1
5 years ago

If someone could help me with this I would love for you to drop the code or teach me on how to do it :)

0
Yes I do know this is not a request site. AdamTHM -1 — 5y
0
Yes, this is indeed not a request site, can't you do it yourself, this is like a tier 1 thing to do, learn and you can achieve whatever you want starmaq 1290 — 5y

Closed as Not Constructive by DeceptiveCaster and starmaq

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
starmaq 1290 Moderation Voter
5 years ago

Ok so for this, we'll be using the Velocity property, which makes it so the part pushes anything that gets on top of it; and that is the general way of making a conveyor. Now, you can just set that and you're ready to go, no scripting needed, but you want to make it togglable, that should be easy. Let's say for example, if we click on the conveyor, or anything else it will start pushing stuff, if we click it again to make it off, it stops. For that we would use a .MouseClick event, which fires (fires basiclly means run) whenever we clicked a part that has a ClickDetector inside it. For more info, I do recommend watching a video about it. So we would have, a script inside the part that is gonna be our conveyor, and also another object called ClickDetector, insert that inside the conveyor. Now, in this I'm not gonna be explaining the absolute basics of scripting, so please learn first. This is a recommadation.

local works = false --this is a variable that we will use to make it togglable, it will be set to false because we want it to start not pushing.
script.Parent.ClickDetector.MouseClick:Connect(function()
--this is how an event is written, you see every piece of code inside this event would work only when the event triggers, and this event triggers when we click on this part.
    if works == false then
        --this is a cool set up: when we click we check if off, if its off we will make it on, and when we click again, we check if its off, but its on, so it turns back to off.
        works = true
        script.Parent.Velocity = Vector3.new(50,0,0)
        --now this part is a bit complicated, it might be different to you, since the velocity would be according to the part's rotation, i set the first number which is the x axis, play with the numbers until its perfect.
    else
        works = false
        script.Parent.Velocity = Vector3.new(0,0,0)
        --we would set it back to 0, to make it not push
    end
end)

And that's really it, sorry for not explaining that much, becuase this is stuff that you would understand instanly if you have knowloedge of scripting, so please learn!

I tested this and it worked out.

Ad