I need to make the conveyors in my game have a beam, but i also need the beam to be the same speed as the conveyor itself. I have a speed value inside the conveyor. Ive searched youtube and on here a little bit but couldn’t find anything.
You can just change the beam’s texture speed, based off of your conveyor’s actual speed.
I know that, but Id rather not have to individually change every single conveyor
That’s not what I mean. If you have a script handling the conveyor’s velocity, preferably in collection service, you can set the conveyor’s tag automatically based off the speed. I don’t believe I said to set them all manually, I meant based off the speed of said conveyor.
Can you provide how you currently have your conveyors and texture set-up as well as the code you have currently handling the conveyor/texture speed?
Using CollectionService you can do something like this:
local CollectionService = game:GetService("CollectionService")
local tag = "Conveyor"
local function tagBehavior(conveyor)
local speed = conveyor.YOUR.SPEED.VAR.HERE
local beam = conveyor.YOUR.BEAM.HERE
beam.TextureSpeed = speed
end
-- Activate behavior for instances added after code execution
CollectionService:GetInstanceAddedSignal(tag):Connect(tagBehavior)
-- Activate behavior for instances added before code execution
for _, obj in pairs(CollectionService:GetTagged(tag)) do
tagBehavior(obj)
end