Cloning items to players UpperTorso only work for some

Hey, this script works for me and other people, but for some people it does not work 100%.
If a value is set to the same name as the item that is going to be cloned it should clone the item everytime a player respawn.

For some reason it only work for some and other not at all. I rewrote the script and I think people can equip the items but for some when they die it disappear. Could it be because of lag?

I added “char:WaitForChild(“UpperTorso”)” but I don’t know if this even helps.

local SS = game:GetService("ServerStorage")

game.Players.PlayerAdded:Connect(function(player)
	player:WaitForChild("ShopValues")
	local effect = player.ShopValues:FindFirstChild("EffectName")
	local PE = SS:FindFirstChild("Effects"):GetChildren()
	
	player.CharacterAdded:Connect(function(char)
		char:WaitForChild("UpperTorso")
	local torso = char:FindFirstChild("UpperTorso")	
		for i,v in pairs(PE) do
			if effect.Value == "" then
				if torso:FindFirstChild("Effect") ~= nil then
				torso:FindFirstChild("Effect"):Destroy()	
				end
				
			elseif effect.Value == v.Name then
				if torso:FindFirstChild("Effect") ~= nil then
					torso:FindFirstChild("Effect"):Destroy()
				end
				local clone = v:Clone()
				clone.Name = "Effect"
				clone.Parent = torso
			end
		end
	end)
	
	effect.Changed:Connect(function(val)
		local character = player.Character
		if not character or not character.Parent then
			character = player.CharacterAdded:wait()
		end
		local torso = character:FindFirstChild("UpperTorso")	
		for i,v in pairs(PE) do
			if val == "" then
				if torso:FindFirstChild("Effect") ~= nil then
					torso:FindFirstChild("Effect"):Destroy()		
				end
				
			elseif val == v.Name then
				if torso:FindFirstChild("Effect") ~= nil then
					torso:FindFirstChild("Effect"):Destroy()
				end
				local clone = v:Clone()
				clone.Name = "Effect"
				clone.Parent = torso
			end
		end
	end)
		player.CharacterAdded:Connect(function(char)		
	end)
end)	

If you have any questions please ask me :slight_smile:
Thanks for the help,
/Xsodar