Hi! Some time ago I made some conveyor belts for my game CaseOh’s Basics. I just want to ask a question. Is there a better way of doing this? Like a way to cause less lag or is there none?
Here is the script:
game:GetService("RunService").Heartbeat:Connect(function()
if script.Parent.On.Value==false then
script.Parent.Beam.TextureSpeed=0.1
script.Parent.Velocity = script.Parent.CFrame.lookVector *8 -- Multiplys the bricks velocity by 15, which causes it to move bricks that land on it.
else
-- here we do the same thing but backwards.
script.Parent.Beam.TextureSpeed=-0.1
script.Parent.Velocity = script.Parent.CFrame.lookVector *-8
end
end)
can’t you just set the part’s AssemblyLinearVelocity to a value of choice, and then anchor the part? since the assembly is technically moving, but anchored it would move any object touching it instead.
You don’t need to set it in a loop.
Just set it once, and then detect for the change in the direction, and only set it again, when the direction switch is changed.