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.
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.
Hey, if youāre having trouble with a script that stops a projectile on impact but ends up detecting the collision too early, too late, or even clips through the obstacle, hereās a simple fix in two steps:
Avoid using touch events. Instead, detect parts during each physics step.
Use raycasts to check if the projectile clipped through the obstacle between rendered frames. (This happens when the projectile moves so fast that its position in the next frame skips past the obstacle, causing it to miss the collision.)
local SubspaceTripmineExplosion = game:GetService("ServerStorage"):WaitForChild("ProjectilesAbilityParts"):WaitForChild("SubspaceTripmineExplosion")
script.Parent.Touched:Connect(function(Touched)
script.Parent.CanTouch = false -- Making the part untouchable to prevent from multiple explosions spawn
local Player = game:GetService("Players"):GetPlayerFromCharacter(Touched.Parent) -- Identifying a player from the touched part
if Player then -- Do something if it's a player
local Explosion = SubspaceTripmineExplosion:Clone() -- Cloning the explosion
Explosion.Parent = workspace -- Setting the parent of it
Explosion.Position = script.Parent.Position -- Changing the explosion position to the part's position
wait(30) -- Making something after 30 seconds delay
script.Parent.CanTouch = true -- Make the part touchable again after 30 seconds and also touchable for other players in the game
else
script.Parent.CanTouch = true -- Make the part touchable again if it's not been touched by a player
end
end)