Here it is only dealing damage to players, but I want to damage npc too, if only npc is around me it will only damage him, if it has the player and npc will deal damage together. And the same for the player.
~LocalModuleScript Damage
local plrs = game.Players:GetPlayers()
table.insert(plrs, game.Workspace.Map.Npcs.Bandit:GetChildren())
-- End dark particles
for i, v in pairs(plrs) do
local char = v.Character
if char then
if v.Name ~= player.Name and (char.HumanoidRootPart.Position - pos).magnitude <= size/2 and math.abs(char.HumanoidRootPart.Position.Y - pos.Y) <= 7 then
affected[#affected + 1] = v
elseif v.Name ~= player.Name and (char.HumanoidRootPart.Position - pos).magnitude <= size then
lessAffected[#lessAffected + 1] = v
end
end
end
--
for i, v in pairs(affected) do
local char = v.Character
if char then
-- damage
for o = 1, 30 * speed do
char.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame - Vector3.new(0, speed/30, 0)
char.Humanoid.Health = char.Humanoid.Health - (damage / (30 * speed))
wait(1/30)
end
end
end
-- Edit/ I just remembered that too.
~Script Damage
local char = player.Character
for i, v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
coroutine.resume(coroutine.create(function() --ModuleScript
local deb = false
v.Touched:Connect(function(hit)
if game.Players:FindFirstChild(hit.Parent.Name) and not deb then
--Script

3 comments
"local char = v.Character" Character is not a valid member of Model Local of npcs "game.Workspace.Npcs.Bandit" --(.Bandit and .BanditBoss)
"table.insert(plrs, game.Workspace.Map.Npcs.Bandit:GetChildren())" There is no error, but the npcs are not getting damaged yet, maybe it's a script error I just added.
Ah my bad you'd have to rewrite it slightly cause you've got a mix of players and characters now, you should add the character models of all players instead, not the players directly