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

how change the speed of the conveyor by touching a brick? [Answerd]

Asked by 10 years ago
Dropper = game.Workspace.Dropper
Catch = game.Workspace.Catch
Conveyor = game.Workspace.Conveyor

function SpeedOfConveyor()
    Conveyor.Velocity(-30, 0, 0)
end

script.Parent.Touched:connect(SpeedOfConveyor)

this for some reason is not working, please help

1 answer

Log in to vote
0
Answered by
Necrorave 560 Moderation Voter
10 years ago

In your code, you are setting the actual conveyors velocity. That will not do anything if the conveyor is anchored. Also, I do not think it will do what you intend even if it wasn't.

One thing you have to keep in mind when using the "Touched" event is the parameter or part that will be triggering this event.

Also, you are not using the correct format to changing the velocity of something. You must try using Vector3.new()

Dropper = game.Workspace.Dropper
Catch = game.Workspace.Catch
Conveyor = game.Workspace.Conveyor

function SpeedOfConveyor(part) -- Added "part" as a parameter
    part.Velocity = Vector3.new(-30, 0, 0)
 --Instead of affecting the conveyor, you affect the part touching the conveyor
-- Also, Vector3.new() was added.
end

script.Parent.Touched:connect(SpeedOfConveyor)

See if that works.

0
ok, now i see what i did wrong, 1 tiny little mistake can ruin it, thank, it now works! C4Motorbiker 10 — 10y
0
Yep! That is the downsie of programming and scripting. Any little mistake can ruin the entire project. Although, it is always fun trying to find the problem. Good luck Necrorave 560 — 10y
1
Actually, if you set an anchored brick's velocity constantly, in a loop, it will behave like a conveyor belt to any other unachored parts! Perci1 4988 — 10y
0
Hmm, I might have to fool around with that. That is new to me. Necrorave 560 — 10y
Ad

Answer this question