So would I loop through all the tags? And what if a new player joins?
You’d tag new humanoids as they are added.
local Game = game
local Players = Game:GetService("Players")
local CollectionService = Game:GetService("CollectionService")
local function OnPlayerAdded(Player)
local function OnCharacterAdded(Character)
local Humanoid = Character:FindFirstChildOfClass("Humanoid") or Character:WaitForChild("Humanoid")
CollectionService:AddTag(Humanoid, "Humanoid")
end
local function OnCharacterRemoving(Character)
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if Humanoid then CollectionService:RemoveTag(Humanoid) end
end
Player.CharacterAdded:Connect(OnCharacterAdded)
Player.CharacterRemoving:Connect(OnCharacterRemoving)
end
Players.PlayerAdded:Connect(OnPlayerAdded)