newFireball.Touched:Connect(function(hit)
if hit.Parent.Name ~= player.Name then
if hit.Parent:FindFirstChild("Humanoid") then
print("humanoid hit", hit.Parent.Name)
else
print("base part hit", hit.Name)
end
end
end)
you would probably want to change your if statement to or instead of and:
newFireball.Touched:Connect(function(hit)
if hit.Parent.Name ~= player.Name and hit.Parent:FindFirstChild("Humanoid") or hit:IsA("BasePart") then
if your checking if the part that touched is a players character i suggest trying this:
local function playerCheck(model:Instance)
local checks = {"Humanoid";"HumanoidRootPart"}
local valid = true
for i,v in pairs(checks) then
if model:FindFirstChild(v) == nil then
valid = false
break
end
end
return valid
end
newFireball.Touched:Connect(function(hit)
if playerCheck(hit.Parent) and hit.Parent.Name ~= player.Name then
...
end
end)