.Touched() Firing Too Early / Too Late

Upon collision, a ball should spawn right in the projectiles position, however it seems to delay, or fire too early, spawning the ball away from the target.

(11.07.2024_19.08.26_REC)

I do not really know how to fix it, or lower the delaying time.

local SubspaceTripmineExplosion = game:GetService("ServerStorage"):WaitForChild("ProjectilesAbilityParts"):WaitForChild("SubspaceTripmineExplosion")

Connection = script.Parent.Touched:Connect(function(hit)
	local Explosion = SubspaceTripmineExplosion:Clone()
	Explosion.Parent = game.Workspace
	Explosion.Position = script.Parent.Position
end)

(there is another script inside the SubspaceTripmineExplosion which tweens it)

1 Like

Is it anchored? And are you sure that the connection is set on time?

what is script.Parent.Position?

Usually positions take a bit to update so based on what I could see on your video it seems like the script.Parent.Position isn’t updating fast enough.

You could try using raycast to detect where is the projectile going to collide.

Also, would you mind sending me a file with your place?
If I get to check it I probably could solve this issue

There is a delay between the client character position and the position of the character on the server. You should fire a remote event from the client and pass the position to the server or create the effect on the client.

Also, the touch event should be created on the client, and the server should only listen for when to create the effect. You should also add in checks such as debounces or if the projectile still exists on the server so players don’t exploit your system and create endless effects on the server.

the script.Parent is the projectile (ball). I tried anchoring it when it collides with an object but it did not work. I can’t send the place right now beacuse it has lots of different stuff inside.

I figured out that the projectile explodes right at the collision position when the game is not laggy (It gives a slight lag when part explode). It probably is the problem.