I have made this simple projectile script, upon touching a part, an explosion will be created unless the part is called NON, then it will ricochet. However, the explosion happens like 0.3 seconds after touching a part, how do I fix this? this is also not a lag issue.
if math.random(1,1) == 1 then local debu = true if debu == true then if hit.Name ~= "NON" then debu = false local explosion = Instance.new("Explosion") explosion.BlastRadius = 4 explosion.BlastPressure = 400000 explosion.Position = script.Parent.Position explosion.Parent = game.Workspace elseif hit.Name == "NON" then debu = false local ric = workspace.RIC:Clone() ric.Parent = workspace ric.Position = script.Parent.Position ric.Ric:Play() ric.ParticleEmitter.Enabled = true script.Parent:Destroy() wait(0.1) ric.PointLight.Enabled = false ric.ParticleEmitter.Enabled = false wait(2) ric:Destroy() end end end local cancollide = true end