Hi, I am trying to make game where players attempt to run away from a death-cube in a tunnel. The issue I have is that I need the cube to move through the tunnel smoothly and at a constant speed, but I’m not sure how I would do this. I need any suggestions as to how I would script it and what method I should use, but preferably a system that is simple enough to apply to multiple different maps.
Although I have already created a system that works, it is overcomplicated, laggy and takes too long to program for each map. Plus, the maps I have created for this game are much more complicated than the image above, so I just made this example to help you understand what needs to be done. I am not asking you to script it for me, I just need some suggestions as to how I should do it. I hope I am not asking for too much. Any help will be appreciated!
One simple way would be to add a humanoid to the block, then you can use Humanoid:MoveTo(position), and just have a folder of points the block goes to.
I managed to do something similar using TweenService. At first, I ruled out using Tweens because I couldn’t get it to move at a constant speed. However, I created an algorithm that cycles through an array of points. It then gets the distance between the current point and the next point and divides it by a speed value to get a time value. It then plugs the time value into the Tween time value, therefore creating a constant speed regardless the distance between points.
The code isn’t too long and it’s applicable to multiple point-arrangements for different maps, which is what I really needed. I appreciate the help!