Fire ball exploded twice and not once

  1. What do you want to achieve? Keep it simple and clear!
    So I am making a fire ball script that will explode on impact

  2. What is the issue? Include screenshots / videos if possible!
    The issue is that when the fire ball hit a dummy or a player it will explode twice so I want to know how to fix the so that it will only explode once

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to use if statement but I can’t figure out how to fix it

	local FBTouched
	
	FBTouched = FB.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Humanoid") then
			if hit.Parent.Name ~= player.Name then
				if canhit == true then
					hit.Parent:WaitForChild("Humanoid"):TakeDamage(20)
					canhit = false
					FB:Destroy()
					canhit = true

					local FBX = FireballFolder.FireExplode:Clone()
					FBX.FireExplosion.Enabled = true
					FBX.CFrame = FB.CFrame * CFrame.new(0,0.5,-8)
					FB:Destroy()
					FBX.Parent = game.Workspace.FX
					wait(1)
					FBX.FireExplosion.Enabled = false
					wait(1.5)
					FBX:Destroy()

					if FBTouched ~= nil then FBTouched:Disconnect() end
				end
			end
		end
		local FBX = FireballFolder.FireExplode:Clone()
		FBX.FireExplosion.Enabled = true
		FBX.CFrame = FB.CFrame * CFrame.new(0,0.5,-8)
		FB:Destroy()
		FBX.Parent = game.Workspace.FX
		wait(1)
		FBX.FireExplosion.Enabled = false
		wait(1.5)
		FBX:Destroy()
		if FBTouched ~= nil then FBTouched:Disconnect() end
	end)

Can you provide the entire script?

Have you tried printing how many parts were hit? It could be firing twice because it is touching 2 parts most likely.

1 Like