Help With Giving A Hit Box To Every Player

Here’s my current script. It only gives a hit box to only one player.

local Players = game:GetService("Players")

local function weld()
	for i,v in pairs(Players:GetChildren()) do
		
		v.CharacterAdded:Wait()
		local hitbox = script.HitBox:Clone()
		local char = v.Character
		local root = char.HumanoidRootPart
		local head = char.Head

		hitbox.CFrame = head.CFrame
		hitbox.Parent = char

		local weld = Instance.new("WeldConstraint")
		weld.Part0 = root
		weld.Part1 = hitbox
		weld.Parent = hitbox
	end
end

Players.PlayerAdded:Connect(function()
	weld()
end)
1 Like

v.CharacterAdded:Wait() this line will inf yield if the character is already loaded

if v.Character == nil then v.CharacterAdded:Wait() end

This would be much better, also because your only using playeradded this will not work on characters that respawn, if you want that functionlity then use .CharacterAdded