hi! im making area of effect (aoe) item things i want to make it takes some damages and burn damage
but script only does work on one enemy i dont know how to fix this
script.Parent.Remote1.OnServerEvent:Connect(function(plr)
local Animation = script.Parent.LmbAnimation1
local Animationtrack = script.Parent.Parent:FindFirstChildWhichIsA("Humanoid"):LoadAnimation(Animation)
Animationtrack:Play()
task.wait(1)
local sound = script.Parent.Sound
sound:Play()
local part = Instance.new("Part", workspace)
part.Shape = Enum.PartType.Ball
part.Size = Vector3.new(5,5,5)
part.BrickColor = BrickColor.new("Neon orange")
part.CanCollide = false
part.Anchored = true
part.Material = Enum.Material.Neon
part.CFrame = script.Parent.Parent:FindFirstChild("HumanoidRootPart").CFrame * CFrame.new(0,-3,-5)
local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Circular, Enum.EasingDirection.Out, 0, false, 0)
local goal = {}
goal.Size = part.Size + Vector3.new(10,10,10)
goal.Transparency = part.Transparency + 1
local ts = game:GetService("TweenService")
local tween = ts:Create(part, tweeninfo, goal)
tween:Play()
local char = plr.Character
local rootpart = char:WaitForChild("HumanoidRootPart")
for i, v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") and v ~= char then
local vhum = v:FindFirstChild("Humanoid")
local vrootpart = v:FindFirstChild("HumanoidRootPart")
if (part.Position - vrootpart.Position).Magnitude <= 5 then
vhum:takeDamage(40)
local firemodule = require(game.ServerScriptService.FireModuleScript)
local head = v:FindFirstChild("Head")
local facecenterattachment = head:FindFirstChild("FaceCenterAttachment")
firemodule:burn(20, facecenterattachment)
end
end
end
game.Debris:AddItem(part, 1.1)
end)
how to run on multiple enemies?