for _, Target in pairs(CollectionService:GetTagged("PlrHumanoids")) do
if Target:IsA("Model") and Target:FindFirstChild("Humanoid") and Target.Parent.Name ~= Character.Name then --Checking if we have a valid model
connection2:Disconnect()
local Humanoid = Target
local RootPart = Target.HumanoidRootPart
if (RootPart.Position - LightBombClone.Position).Magnitude < Radius then --Checking if there are Targets in range of the AOE
connection2:Disconnect()
Humanoid:TakeDamage(Damage)
end
end
end
and this is my way to catch all players’ humanoids, why it didn’t work?
in ServerScriptService:
local CollectionServer = game:GetService("CollectionService")
game.Players.PlayerAdded:Connect(function(Plr)
local Hum = Plr:FindFirstChild("Humanoid")
CollectionServer:AddTag(Hum, "PlrHumanoids")
print(Hum)
print(CollectionServer:GetTagged("PlrHumanoids"))
end)`
You’re using Magnitude right, the issue is that either the GetTagged function returned back by the loop isn’t finding anything, or you’re not referencing a variable correctly
Actually looking at it again, you’re referencing Target as the Humanoid, and this line here would result in an error: