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

On/off conveyor

Asked by 10 years ago

I like to make a conveyor which has to buttons: Basically one to turn the conveyor on and one to turn it off. I already made sort of a machine that could do this but the problem was, when there was a brick(not moving) on the conveyor while the velocity of the conveyor was 0(off state) and I tried to activate the conveyor again. The velocity did go up back again to 20 but the brick didn't move anymore.

Can someone explain me what I did wrong? This is my script

Parts = script.Parent
OnButton = Parts.OnButton
OffButton = Parts.OffButton
Conveyor = Parts.Conveyor

function OnButtonClick(playerWhoClicked)
OnButton.Transparency = 0
OffButton.Transparency = 0.5
Conveyor.Velocity = Vector3.new(20, 0, 0)
end

function OffButtonClick(playerWhoClicked)
OffButton.Transparency = 0
OnButton.Transparency = 0.5
Conveyor.Velocity = Vector3.new(0, 0, 0)
end

OnButton.ClickDetector.MouseClick:connect(OnButtonClick)
OffButton.ClickDetector.MouseClick:connect(OffButtonClick)

I am using 3 bricks the conveyor, onbutton and offbutton. The buttons have a clickdetector in them. Someone already told me it may be roblox's "sleeping parts".** The question is so, how can the conveyor itself make the brick moving again?(because I can step on it and the bricks will move again but I don't want that)**

1 answer

Log in to vote
0
Answered by 10 years ago

If the brick is anchored that you put on the conveyor make it unanchored, just in case you feel like being wierd you can just put a script in there saying something like brick.Anchored = false or something like that.

Ad

Answer this question