Are all Events Delayed?

You weren’t updating the position manually though you were using velocity which you have no control over.

So you’d suggest just CFraming a part in a direction instead of using a smooth transition with bodyvelocity or velocity?

Yah, you don’t actually know when velocity updates the raycast should be made when the part’s position updates to the new position.

Also you can do a smooth transition with CFrame to. Using Hearbeat:Wait()and the deltatime reiceved.

That’s a fair point I’d say. So how about the smooth transition for CFrame? I know you can use tweenservice to transition a value/property, but aren’t services not meant to be spammed with?

local ElapsedTime = 0

RunService.hearbeat:Connect(function(v)
ElapsedTime += v
Part.Position = Vector3Direction * ElapsedTime

– do raycasting
end)

Yah don’t use tweenservice.

Isn’t runservice also a service though, using that may add on to game performance since everyone would be spamming cannons, or projectiles.

You only need one hearbeat connection and lopp through the array of projectiles, store each projectile you make in an array.

Also services don’t cause lag that doesn’t really make sense?

If you use them too much they can time out, or something relative to that. I know you can’t use some services all the time.

No… That’s for datastore service. And HttpService.

There’s a lot more services too that can’t be spammed with. Services in general do cost performance to use from what I’ve heard.

They don’t. Only the servers which perform requests like datastoreservice do.

Maybe others do but RunService doesn’t. A service essentially is just a collection of functions.

if you still don’t believe me here’s a living proof.

This module can handle 400 bullets a second, and yes it uses RunService.

1 Like

Alright I’ll take your word for it. Gonna see if this method works.

Yeah I tried that method, it works fine. Only problem I have for it is what about cannonballs? You’d have to use some crazy math to make the part start moving downwards after a while. And if you say just unanchor it, well you can’t check the coordinates for it as it’s unpredictable once it’s unanchored.

It’s not clear to me if anyone has said this yet. But if that event handler is running server-side, then the “delay” you’re seeing is just network lag. On your computer, you touch the part. Some time later, the server learns that happened. Then the server’s event handler runs, and changes the color of the brick for example. Then another amount of time later, your client learns of this and you see the new color. In other words, the delay is just ping.

You don’t have to use crazy math there’s already a simple equation someone made for it. And no don’t unanchor it.
local Gravity = 100
local Velocity = Vector3Direction * Speed- (Vector3.new(0,Gravity,0) * ElapsedTime)
Position = Projectile.Position + (Velocity * TimeFromPreviousFrame)

RunService.Hearbeat:Connect(function(TimeFromPreviousFrame) -- TimeFromPreviousFrame is hearbeat gives us back

Reading up on your original issue, this seems like an exceedingly large replication delay.

I have a few questions trying to understand this better:

  • What ping do you get playing in your Roblox game? You should be able to view this by pressing F9 to open up the developer console
  • Are there any server scripts that are running at high percentages that could be lagging your game down? (You can view this using the Script Performance tab.)
1 Like

First Question: 80-100
Second Question: Far from what I’ve seen there aren’t any scripts causing much disruption for the server.

Also @0Shank I’ll try that and see if it works.

What’s going on here is that you need to take into account that Roblox uses distributed physics: Physics for a given part is simulated on the whichever client “owns” that part. That means that if you listen for a Touched event on that part that is owned by some other client, you will see a replication delay between the the client who owns the part seeing a touch happen, and them sending a message across the network to everyone else letting them know that the Touched event should fire.

You can control this by calling Part:SetNetworkOwner(player) (or Part:SetNeworkOwner(nil) to force server ownership). If you make this call to set the ownership, then Touched events for that part should always be instantaneous on the client/server you set the ownership to, since they’re the one doing the physics simulation now.

1 Like

This is happening to me recently, I would say it is a Roblox bug. i will report it.

same… but I used region3s. I’m making a beat maker where i time marker touches the note blocks while passing though it. but its not on time making it off beat