This sounds insane, but I need help if there is something faster than task.wait()
Currently Im using task.wait() to in a while true loop to check for parts in a table. And since the part moves very fast, i need a extremely fast wait
This sounds insane, but I need help if there is something faster than task.wait()
Currently Im using task.wait() to in a while true loop to check for parts in a table. And since the part moves very fast, i need a extremely fast wait
The part’s position only updates every frame, so what could you need something faster than task.wait for? Could you explain your use case a bit more?
Ok so i have a train game. The train uses tween service to move so i cant use touchevent. When the train I want train to play a sound when it touches a part. Currently when the train passes the part, its so fast that the task.wait() in the while true do wasnt able to check at the same time the train touch part
Instead of doing .Touched, use raycasting towards parts to see what can be hit.
https://create.roblox.com/docs/reference/engine/classes/RunService#RenderStepped
You could try RunService.RenderStepped
, which fires every frame, prior to rendering.
render on server or client e30char???
Things like RenderStepped
and BindToRenderStep
are only available on the client, you could use Heartbeat
instead. Check out the RunService documentation as has been suggested multiple times in this topic already.
I don’t think you’re going about this the right way. There will be a better way to do this, but you might need to share your code.
I told this person three days ago that they should use physics constraints to do this instead of TweenService
or other methods that prevent the Touched
event from firing. I unfortunately fell short when they asked for help regarding prismatic constraints, because I have not used them yet myself.
I was hoping that someone else who knew more about them would come along and provide some insight for them. But alas, that has not happened and this person is now committed to using non-physics-friendly methods to move their train.
@Chimmy_Coder a quick Google search (if you don’t like using Google, my query was “prismatic constraint roblox”) yields results including a good number of videos that explain what they are, how to use them, as well as real-world examples such as creating elevators in your games.
I really think you should try using a physics-based solution again, because I have noticed that you’ve been searching for a less-than-preferable solution to your problem while using TweenService
ever since I saw your initial post and I don’t think it (TweenService
) will enable you to create an elegant solution for your problem.
My opinion lies soley on the fact that you’ve been asking multiple questions on how to work around the fact that the BasePart.Touched
event does not fire for collisions not caused by physics simulation, working with physics would simply allow you to use the Touched
event as usual instead of having to invent some sort of crazy alternative.
If you still don’t want to use prismatic constraints or other types (as handling corners may be a little challenging, requiring you to move or swap what constraint the train and its carriages follow), you could consult this post in response to a similar problem (which uses the easier-to-understand AlignPosition
and AlignOrientation
constraints), though keep it mind it was intended for single-player vehicles that are given network ownership of the physics.
As i have said, I cannot use physics trains. I just cant. I made multiple post on trying to resolve problems but its just not possible.
Character platform sticking doesn’t work if the train is moved by CFrame (last I checked, I recall them looking into that). Won’t that be a problem?
If you want to do it super simply, just have the trains all in their own collision group that doesn’t collide with its self (if the trains need to turn) and use mover constraints (align position and align orientation) to move the train. Those work just like CFrame (when set to a high enough force) but use physics instead.
Trains are super hard to make work properly from what I’ve heard.
Its not faster than task.wait(), task.wait() works on RunService runtime, and runservice runs 30-120 times a second, meanwhile task.wait() runs 60-240 times a second
task.wait()
is just RunService.Heartbeat:Wait()
when it has no parameter. You can go “faster” though by combining multiple events that run at different times. More than likely though, only one of the events is needed.
There really isn’t any reason to go faster than task.wait():
Heartbeat runs just as fast as everything else. What you probably want is to run the code at a different time, like before the physics simulation with stepped (probably will still have the same result though).
Also, are you doing this to add character platform sticking to anchored objects or to get touched events for anchored objects? If you are, there are better ways of doing both of those (the latter is hacky though).
When did I say something related to this?
You suggested using RunService instead of task.wait()
, they stated that task.wait()
is just RunService.Heartbeat:Wait()
.
Still doesn’t answer my question.
I’m not so sure what is important about a Date? Why do I need to know this? This is a very random thing.
But this still doesn’t answer my question, When did I mention task.wait
or RunService.Heartbeat?
I see it was already solved but could you just make the part longer so the train is in it for a greater amount of time
It’s literally the date you mentioned RunService.Heartbeat
. Scroll up
Just don’t reply anymore, I don’t want to necropost.