part = script.Parent part.Touched:connect(function() if not part.Anchored then part.Anchored end end)
This is the most basic example. Imagine i want to anchor the part exactly when it hit another part. In a server it lags so the part gets anchored a bit later resulting in it being anchored many times inside the part that it hit.
I want to deal find a way to deal with that lag so i add a couple of effects when certain parts hit others. For example, an explosion. To do that i want the position of the part when it hit:
part = script.Parent debounce = false part.Touched:connect(function() if not debounce then debounce = true position = part.Position end end)
But then again, the touch event is delayed and i get a position that i don't want, a position that corresponds for example to one where the part already got inside of the part it hit as a result of the lag once again.
So does anyone have any idea how to deal with this?
I see for example in NO2 of Snakeworl explosion effects happening as a result of attacks hitting walls.. When i try to replicate that, my effects get inside the walls in the servers because of the lag i've talked about.