(UNSOLVED) Projectile script glitches

  1. What do you want to achieve?
    Fixing my projectile script so that it doesn’t glitch.

  2. What is the issue?
    Projectile randomly stops and glitches.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Rescripting

--workspace.ignore is where fireball part and explosion part is parented to
local FireballOverlapParams = OverlapParams.new()
	FireballOverlapParams.FilterType = Enum.RaycastFilterType.Exclude
	FireballOverlapParams.FilterDescendantsInstances = { workspace.Ignore, character}
local connection
	local startTime = os.clock()
	local hit = false
	
	local humanoid = nil

	connection = RunService.Heartbeat:Connect(function(dt)
		local direction = (mouseHit.Position - Fireball.Position).unit
		Fireball.CFrame = CFrame.new(Fireball.Position) + direction * dt * 80
		
		local hitParts = workspace:GetPartsInPart(Fireball, FireballOverlapParams)
		if #hitParts ~= 0 then
			hit = true
			--explosion function here

			for i, v in ipairs(hitParts) do
				if v.Parent:FindFirstChild("Humanoid") then
					humanoid = v.Parent:FindFirstChild("Humanoid")
				end
			end
		end

		if hit then
			if humanoid then
				humanoid:TakeDamage(15)
				--knockback function here
			end
			connection:Disconnect()

			--fireball particles disabled here
			wait(3.5)
			Fireball:Destroy()
		end

		Fireball.CFrame = CFrame.new(Fireball.Position) + direction * dt * 80
		if os.clock() >= startTime + 4 then
			connection:Disconnect()
			--fireball particles disabled here
			wait(3.5)
			Fireball:Destroy()
			return
		end

Seems like the wait(3.5) when the script detect a hit, is the cause. Did you try to reduce the time?

I replaced both with
task.delay(1,function()
Fireball:Destroy()
end)
And it still glitches, so I don’t think that’s the problem.

is the projectile anchored? (char lim)

the projectile is anchored. if i unanchor it, it bounces