Fireball Not Working?

So I copied a fireball that @Alvin_Blox made, but it’s not doing damage on the npcs. Everything works great, the fireball launches but apparentlly, it does no damage:

local fireball = game:GetService('ServerStorage'):FindFirstChild('Fireball')
local event = game:GetService('ReplicatedStorage'):FindFirstChild('FireEvent')

event.OnServerEvent:Connect(function(player)
	local character = player.Character
	local fb2 = fireball:Clone()
	fb2.CFrame = character:FindFirstChild('HumanoidRootPart').CFrame
	
	local bodyVelocity = Instance.new('BodyVelocity')
	bodyVelocity.MaxForce = Vector3.new(5000, 5000, 5000)
	bodyVelocity.Velocity = (character:FindFirstChild('HumanoidRootPart').CFrame.lookVector*250)
	bodyVelocity.Parent = fb2
	
	fb2.Parent = workspace
	
	local touchConn
	
	touchConn = fb2.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild('Humanoid') then
			if not hit.Parent.Name == player.Name then
				hit.Parent:BreakJoints()
				
				if touchConn ~= nil then
					touchConn:Disconnect()
				end
			end
		end
	end)
	
	wait(2)
	
	if touchConn ~= nil then
		touchConn:Disconnect()
	end
	
	fb2:Destroy()
end)

Focus primarly (I think) on the touched event, I think thats where the problem lies.

But, I’ve tried it on various npc’s and it don’t work.

1 Like

Add print() statements inside & outside when connecting the function? :thinking: It might be because of the not hit.Parent.Name == player.Name but I’m not certain

touchConn = fb2.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild('Humanoid') then
			if hit.Parent.Name ~= player.Name then
				hit.Parent:BreakJoints()
				
				if touchConn ~= nil then
					touchConn:Disconnect()
				end
			end
		end
	end)

Try this.

1 Like

Sorry for the delayed reply, I posted this at night.

1 Like